From 2a601849dc3ca39e4d3b5beaecdf222f089c4fae Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 9 Jul 2024 14:38:23 +0200 Subject: [PATCH] chg: [app:the-scores] Sort players by email --- config.py.sample | 4 ++-- exercise.py | 1 + server.py | 4 ++-- src/components/TheScores.vue | 11 ++++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/config.py.sample b/config.py.sample index 66282f4..ee64a9a 100644 --- a/config.py.sample +++ b/config.py.sample @@ -9,14 +9,14 @@ misp_skipssl = True live_logs_accepted_scope = { 'events': ['add', 'edit', 'delete', 'restSearch',], - 'attributes': ['add', 'edit', 'delete', 'restSearch',], + 'attributes': ['add', 'add_attachment', 'edit', 'delete', 'restSearch',], 'eventReports': ['add', 'edit', 'delete',], 'tags': '*', } user_activity_accepted_scope = { 'events': ['view', 'add', 'edit', 'delete', 'restSearch',], - 'attributes': ['add', 'edit', 'delete', 'restSearch',], + 'attributes': ['add', 'add_attachment', 'edit', 'delete', 'restSearch',], 'objects': ['add', 'edit', 'delete',], 'eventReports': ['view', 'add', 'edit', 'delete',], 'tags': '*', diff --git a/exercise.py b/exercise.py index 7c3c207..0d6753d 100644 --- a/exercise.py +++ b/exercise.py @@ -331,6 +331,7 @@ def get_progress(): continue progress[user_id] = { 'email': db.USER_ID_TO_EMAIL_MAPPING[user_id], + 'user_id': user_id, 'exercises': {}, } for exec_uuid, tasks_completion in completion_for_users[user_id].items(): diff --git a/server.py b/server.py index 0534dc7..c89fe5e 100755 --- a/server.py +++ b/server.py @@ -246,12 +246,12 @@ async def forward_zmq_to_socketio(): while True: message = await zsocket.recv_string() topic, s, m = message.partition(" ") - await handleMessage(topic, s, m) try: ZMQ_MESSAGE_COUNT += 1 ZMQ_LAST_TIME = time.time() - # await handleMessage(topic, s, m) + await handleMessage(topic, s, m) except Exception as e: + print(e) logger.error('Error handling message %s', e) diff --git a/src/components/TheScores.vue b/src/components/TheScores.vue index 119b480..72c2cc0 100644 --- a/src/components/TheScores.vue +++ b/src/components/TheScores.vue @@ -22,6 +22,15 @@ const hasExercises = computed(() => exercises.value.length > 0) const hasProgress = computed(() => Object.keys(progresses.value).length > 0) + const sortedProgress = computed(() => Object.values(progresses.value).sort((a, b) => { + if (a.email < b.email) { + return -1; + } + if (a.email > b.email) { + return 1; + } + return 0; + })) @@ -85,7 +94,7 @@