Example #1
0
def get_sync_logs_for_user(user_id, limit):
    rows = synclog_view(
        "phone/sync_logs_by_user",
        startkey=[user_id, {}],
        endkey=[user_id],
        descending=True,
        reduce=False,
        limit=limit,
        include_docs=True,
        stale=stale_ok()
    )
    sync_log_jsons = (row['doc'] for row in rows)
    return [properly_wrap_sync_log(sync_log_json) for sync_log_json in sync_log_jsons]
    def handle(self, user_id, date, **options):
        results = synclog_view(
            "phone/sync_logs_by_user",
            startkey=[user_id, {}],
            endkey=[user_id, date],
            descending=True,
            reduce=False,
            include_docs=True,
        )

        logs = []
        for res in results:
            log = SimplifiedSyncLog.wrap(res['doc'])
            log.case_ids_on_phone = {'broken to force 412'}
            logs.append(log)
        SimplifiedSyncLog.bulk_save(logs)
Example #3
0
    def handle(self, *args, **options):
        if len(args) != 2:
            raise CommandError("Usage is ./manage.py invalidate_sync_heads %s" % self.args)
        user_id = args[0]
        date = args[1]
        results = synclog_view(
            "phone/sync_logs_by_user",
            startkey=[user_id, {}],
            endkey=[user_id, date],
            descending=True,
            reduce=False,
            include_docs=True,
        )

        logs = []
        for res in results:
            log = SimplifiedSyncLog.wrap(res['doc'])
            log.case_ids_on_phone = {'broken to force 412'}
            logs.append(log)
        SimplifiedSyncLog.bulk_save(logs)
Example #4
0
    def handle(self, *args, **options):
        if len(args) != 2:
            raise CommandError(
                "Usage is ./manage.py invalidate_sync_heads %s" % self.args)
        user_id = args[0]
        date = args[1]
        results = synclog_view(
            "phone/sync_logs_by_user",
            startkey=[user_id, {}],
            endkey=[user_id, date],
            descending=True,
            reduce=False,
            include_docs=True,
        )

        logs = []
        for res in results:
            log = SimplifiedSyncLog.wrap(res['doc'])
            log.case_ids_on_phone = {'broken to force 412'}
            logs.append(log)
        SimplifiedSyncLog.bulk_save(logs)
Example #5
0
def update_analytics_indexes():
    synclog_view("phone/sync_logs_by_user", limit=1, reduce=False)