chg: [app:the-scores] Sort players by email

This commit is contained in:
Sami Mokaddem 2024-07-09 14:38:23 +02:00
parent cffb761c4d
commit 2a601849dc
4 changed files with 15 additions and 5 deletions

View file

@ -9,14 +9,14 @@ misp_skipssl = True
live_logs_accepted_scope = { live_logs_accepted_scope = {
'events': ['add', 'edit', 'delete', 'restSearch',], 'events': ['add', 'edit', 'delete', 'restSearch',],
'attributes': ['add', 'edit', 'delete', 'restSearch',], 'attributes': ['add', 'add_attachment', 'edit', 'delete', 'restSearch',],
'eventReports': ['add', 'edit', 'delete',], 'eventReports': ['add', 'edit', 'delete',],
'tags': '*', 'tags': '*',
} }
user_activity_accepted_scope = { user_activity_accepted_scope = {
'events': ['view', 'add', 'edit', 'delete', 'restSearch',], 'events': ['view', 'add', 'edit', 'delete', 'restSearch',],
'attributes': ['add', 'edit', 'delete', 'restSearch',], 'attributes': ['add', 'add_attachment', 'edit', 'delete', 'restSearch',],
'objects': ['add', 'edit', 'delete',], 'objects': ['add', 'edit', 'delete',],
'eventReports': ['view', 'add', 'edit', 'delete',], 'eventReports': ['view', 'add', 'edit', 'delete',],
'tags': '*', 'tags': '*',

View file

@ -331,6 +331,7 @@ def get_progress():
continue continue
progress[user_id] = { progress[user_id] = {
'email': db.USER_ID_TO_EMAIL_MAPPING[user_id], 'email': db.USER_ID_TO_EMAIL_MAPPING[user_id],
'user_id': user_id,
'exercises': {}, 'exercises': {},
} }
for exec_uuid, tasks_completion in completion_for_users[user_id].items(): for exec_uuid, tasks_completion in completion_for_users[user_id].items():

View file

@ -246,12 +246,12 @@ async def forward_zmq_to_socketio():
while True: while True:
message = await zsocket.recv_string() message = await zsocket.recv_string()
topic, s, m = message.partition(" ") topic, s, m = message.partition(" ")
await handleMessage(topic, s, m)
try: try:
ZMQ_MESSAGE_COUNT += 1 ZMQ_MESSAGE_COUNT += 1
ZMQ_LAST_TIME = time.time() ZMQ_LAST_TIME = time.time()
# await handleMessage(topic, s, m) await handleMessage(topic, s, m)
except Exception as e: except Exception as e:
print(e)
logger.error('Error handling message %s', e) logger.error('Error handling message %s', e)

View file

@ -22,6 +22,15 @@
const hasExercises = computed(() => exercises.value.length > 0) const hasExercises = computed(() => exercises.value.length > 0)
const hasProgress = computed(() => Object.keys(progresses.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;
}))
</script> </script>
@ -85,7 +94,7 @@
</td> </td>
</tr> </tr>
<template v-else> <template v-else>
<tr v-for="(progress, user_id) in progresses" :key="user_id" class="bg-slate-100 dark:bg-slate-900"> <tr v-for="(progress) in sortedProgress" :key="progress.user_id" class="bg-slate-100 dark:bg-slate-900">
<td class="border-b border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 p-0 pl-2 relative"> <td class="border-b border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 p-0 pl-2 relative">
<span class="flex flex-col max-w-60"> <span class="flex flex-col max-w-60">
<span :title="user_id" class="text-nowrap inline-block leading-5 truncate"> <span :title="user_id" class="text-nowrap inline-block leading-5 truncate">