This commit is contained in:
Paul Zinselmeyer 2023-11-05 23:01:47 +01:00
parent f5485b773b
commit 4ce5c5270b
Signed by: pfzetto
GPG key ID: 4EEF46A5B276E648
11 changed files with 1206 additions and 131 deletions

View file

@ -1,10 +1,8 @@
<article>
<h1><%= name %></h1>
<% for (index, answer) in answers.iter().enumerate() { %>
<form method="POST" hx-post="" hx-target="closest main">
<input type="hidden" name="player_id" value="<%= player_id %>"></input>
<input type="hidden" name="value" value="<%= index %>"></input>
<button type="submit"><%= answer %></button>
</form>
<% } %>
</article>
<h1><%= name %></h1>
<% for (index, answer) in answers.iter().enumerate() { %>
<form method="POST" hx-post="" hx-target="closest main">
<input type="hidden" name="player_id" value="<%= player_id %>"></input>
<input type="hidden" name="value" value="<%= index %>"></input>
<button type="submit"><%= answer %></button>
</form>
<% } %>

View file

@ -1,18 +1,14 @@
<% if is_correct { %>
<article class="centered">
<h1>Correct</h1>
<p>Your answer is correct. The correct answer is <b><%= correct_answer %></b>.</p>
</article>
<h1>Correct</h1>
<p>Your answer is correct. The correct answer is <b><%= correct_answer %></b>.</p>
<% } else { %>
<article class="centered">
<h1>Wrong</h1>
<p>
Your answer is incorrect. The correct answer is <b><%= correct_answer %></b>.
<% if let Some(player_answer) = player_answer { %>
You answered <b><%= player_answer %></b>.
<% } else { %>
You didn't answer the question.
<% } %>
</p>
</article>
<h1>Wrong</h1>
<p>
Your answer is incorrect. The correct answer is <b><%= correct_answer %></b>.
<% if let Some(player_answer) = player_answer { %>
You answered <b><%= player_answer %></b>.
<% } else { %>
You didn't answer the question.
<% } %>
</p>
<% } %>

View file

@ -1,7 +1,6 @@
<h2><%= name %></h2>
<span>Total Participants: <b><%= total_submissions %></b></span>
<% if show_result { %>
<br/>
<span>The correct answer is: <b><%= correct_answer %></b></span>
<% } %>
@ -18,34 +17,72 @@
"<%= answer %>",
<% } %>
],
<% if show_result { %>
datasets: [
{
label: "correct answers",
data: [
<% for submissions in submissions_correct.iter() { %>
<%= submissions %>,
<% } %>
],
borderWidth: 1,
borderColor: '#fff',
backgroundColor: '#fff',
},
{
label: "wrong answers",
data: [
<% for submissions in submissions_wrong.iter() { %>
<%= submissions %>,
<% } %>
],
borderWidth: 2,
borderColor: '#fff',
backgroundColor: [ pattern.draw('diagonal-right-left', '#000000') ],
}
]
<% } else { %>
datasets: [{
label: "# der Stimmen",
data: [
<% for submissions in submissions.iter() { %>
<%= submissions %>,
<% } %>
],
borderWidth: 1
borderWidth: 2,
borderColor: '#FFF',
backgroundColor: [ pattern.draw('diagonal-right-left', '#000000') ]
}]
<% } %>
},
options: {
legend: {
display: false
plugins: {
legend: {
display: false
}
},
scales: {
x: {
stacked: true,
ticks: {
font: {
size: 64
}
size: 64,
family: 'monospace'
},
color: '#FFF'
}
},
y: {
beginAtZero: true,
stacked: true,
ticks: {
font: {
size:24
}
size: 16,
family: 'monospace'
},
color: '#FFF'
}
}
}