✨ Added Answer-Count to admin screen
This commit is contained in:
@@ -471,5 +471,5 @@ class PrivateStorageItem(PublicStorageItem):
|
||||
|
||||
|
||||
class UpdateStorageItem(BaseModel):
|
||||
filename: str
|
||||
alt_text: str
|
||||
filename: str | None
|
||||
alt_text: str | None
|
||||
|
||||
@@ -197,6 +197,10 @@ async def update_image_data(
|
||||
file_data = await StorageItem.objects.get_or_none(id=file_id, user=user, deleted_at=None)
|
||||
if file_data is None:
|
||||
raise HTTPException(status_code=404, detail="File not found")
|
||||
if data.alt_text == "":
|
||||
data.alt_text = None
|
||||
if data.filename == "":
|
||||
data.filename = None
|
||||
file_data.filename = data.filename
|
||||
file_data.alt_text = data.alt_text
|
||||
await file_data.update()
|
||||
|
||||
@@ -390,6 +390,7 @@ async def submit_answer(sid: str, data: dict):
|
||||
answers, game_pin=session["game_pin"], data=answer_data, q_index=int(float(data.question_index))
|
||||
)
|
||||
player_count = await redis.scard(f"game_session:{session['game_pin']}:players")
|
||||
await sio.emit("player_answer", {})
|
||||
if len(answers.__root__) == player_count:
|
||||
# await sio.emit(
|
||||
# "question_results",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
let shown_question_now: number;
|
||||
let final_results_clicked = false;
|
||||
let timer_interval;
|
||||
let answer_count = 0;
|
||||
export let control_visible: boolean;
|
||||
|
||||
export let player_scores;
|
||||
@@ -53,6 +54,7 @@
|
||||
shown_question_now = data.question_index;
|
||||
timer_res = quiz_data.questions[data.question_index].time;
|
||||
selected_question = selected_question + 1;
|
||||
answer_count = 0;
|
||||
timer(timer_res);
|
||||
});
|
||||
const get_question_results = () => {
|
||||
@@ -95,6 +97,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('player_answer', (_) => {
|
||||
answer_count += 1;
|
||||
});
|
||||
|
||||
const timer = (time: string) => {
|
||||
let seconds = Number(time);
|
||||
timer_interval = setInterval(() => {
|
||||
@@ -179,13 +185,13 @@
|
||||
{/if}
|
||||
{:else}
|
||||
<!-- <button
|
||||
on:click={() => {
|
||||
set_question_number(selected_question + 1);
|
||||
}}
|
||||
class='admin-button'
|
||||
>Next Question ({selected_question + 2}
|
||||
)
|
||||
</button>-->
|
||||
on:click={() => {
|
||||
set_question_number(selected_question + 1);
|
||||
}}
|
||||
class='admin-button'
|
||||
>Next Question ({selected_question + 2}
|
||||
)
|
||||
</button>-->
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -215,12 +221,18 @@
|
||||
{@html quiz_data.questions[selected_question].question}
|
||||
</h1>
|
||||
<!-- <span class='text-center py-2 text-lg'>{$t('admin_page.time_left')}: {timer_res}</span>-->
|
||||
<div class="mx-auto my-2">
|
||||
<CircularTimer
|
||||
bind:text={timer_res}
|
||||
bind:progress={circular_progress}
|
||||
color="#ef4444"
|
||||
/>
|
||||
<div class="grid grid-cols-3 my-2">
|
||||
<span />
|
||||
<div class="m-auto">
|
||||
<CircularTimer
|
||||
bind:text={timer_res}
|
||||
bind:progress={circular_progress}
|
||||
color="#ef4444"
|
||||
/>
|
||||
</div>
|
||||
<p class="m-auto text-3xl">
|
||||
{$t('admin_page.answers_submitted', { answer_count: answer_count })}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{#if quiz_data.questions[selected_question].image !== null}
|
||||
|
||||
@@ -181,7 +181,10 @@
|
||||
"progress": "Progress",
|
||||
"speed": "Speed",
|
||||
"upload": "Upload",
|
||||
"files_library": "Files Library"
|
||||
"files_library": "Files Library",
|
||||
"answer_plural": "Answers",
|
||||
"yes": "Yes",
|
||||
"no": "no"
|
||||
},
|
||||
"editor": {
|
||||
"time_in_seconds": "Time in seconds",
|
||||
@@ -229,7 +232,8 @@
|
||||
"next_question": "Next Question ({{question}})",
|
||||
"show_results": "Show results",
|
||||
"stop_time_and_solutions": "Stop time and show solutions",
|
||||
"enter_answer_into_field": "Enter your answer into the input field!"
|
||||
"enter_answer_into_field": "Enter your answer into the input field!",
|
||||
"answers_submitted": "{{answer_count}} Answers submitted"
|
||||
},
|
||||
"password_reset_page": {
|
||||
"reset_password": "Reset password"
|
||||
@@ -407,7 +411,7 @@
|
||||
"caption": "Caption: {{caption}}",
|
||||
"filename": "Filename: {{filename}}",
|
||||
"uploaded": "Uploaded: {{date}}",
|
||||
"Imported": "Imported: {{yes_or_no}}",
|
||||
"imported": "Imported: {{yes_or_no}}",
|
||||
"edit_details": "Edit details",
|
||||
"delete_image": "Delete image",
|
||||
"edit_the_image": "Edit the image",
|
||||
|
||||
Reference in New Issue
Block a user