mirror of
https://github.com/godotengine/godot-showreel-voting.git
synced 2026-09-03 18:15:13 +03:00
fixed errors when handling multiple showreels
This commit is contained in:
@@ -32,28 +32,13 @@
|
||||
|
||||
<button type="submit" class="button primary small">Save</button>
|
||||
</form>
|
||||
|
||||
<h1 style="margin-bottom: 20px;">Vote results</h1>
|
||||
<div>
|
||||
<p>Total votes: <strong>{{ total_votes }}</strong></p>
|
||||
<p>Positive votes: <strong>{{ positive_votes }}</strong></p>
|
||||
<p>Negative votes: <strong>{{ total_votes - positive_votes }}</strong></p>
|
||||
</div>
|
||||
<br>
|
||||
<form action="{{ url_for('votes.download_vote_results') }}" method="get" style="display:inline;">
|
||||
<input type="hidden" id="download-showreel-id" name="showreel_id" value="">
|
||||
<button type="submit" class="button primary small">Download results .csv</button>
|
||||
</form>
|
||||
<div>
|
||||
<div class="entries">
|
||||
{% for entry in vote_tally %}
|
||||
<div class="entry panel padded">
|
||||
<h2><a href="{{ url_for('votes.video_view', video_id=entry[0].id) }}">{{ entry[0].game }}</a></h2>
|
||||
<p>Category: <strong>{{ entry[0].showreel.title }}</strong></p>
|
||||
<p>Author: <strong>{{ entry[0].author_name }}</strong></p>
|
||||
<p>Vote sum: <strong>{{ entry[1] }}</strong></p>
|
||||
<p>Votes received: <strong>{{ entry[2] }}</strong></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div id="vote-results">
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -61,6 +46,8 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const showreelSelect = document.getElementById('showreel_id');
|
||||
const statusSelect = document.getElementById('showreel_status');
|
||||
const voteResults = document.getElementById('vote-results');
|
||||
const downloadShowreelId = document.getElementById('download-showreel-id');
|
||||
|
||||
function updateStatus() {
|
||||
const selectedOption = showreelSelect.options[showreelSelect.selectedIndex];
|
||||
@@ -69,10 +56,25 @@
|
||||
if (!status) return;
|
||||
|
||||
statusSelect.value = status;
|
||||
downloadShowreelId.value = showreelSelect.value;
|
||||
}
|
||||
|
||||
showreelSelect.addEventListener('change', updateStatus);
|
||||
function updateResults() {
|
||||
const showreelId = showreelSelect.value;
|
||||
|
||||
fetch(`/showreel-results?showreel_id=${showreelId}`)
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
voteResults.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
showreelSelect.addEventListener('change', function () {
|
||||
updateStatus();
|
||||
updateResults();
|
||||
});
|
||||
|
||||
updateStatus();
|
||||
updateResults();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
@@ -20,64 +20,64 @@
|
||||
}
|
||||
</style>
|
||||
<main>
|
||||
{% if submission_success %}
|
||||
<div class="panel padded">
|
||||
<h2>Thank you for your submission!</h2>
|
||||
<p>Your entry has been received, voting will start on <strong>?????</strong> 📅</p>
|
||||
{% if active_submissions %}
|
||||
<div class="panel padded" style="margin-top: 20px;">
|
||||
<!-- During the submission period -->
|
||||
{% if user %}
|
||||
{% if submission_success %}
|
||||
<h2>Thank you for your submission!</h2>
|
||||
<p>Your entry has been received, voting will start on <strong>?????</strong> 📅</p>
|
||||
{% else %}
|
||||
<p>Submit your game for the Godot showreel until <strong>?????</strong> 📅</p>
|
||||
{% endif %}
|
||||
<a class="button primary" href="/submit">Submit entry</a>
|
||||
{% else %}
|
||||
You need to be logged in to submit an entry:
|
||||
<a href="/login" class="button dim small">Log In</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% elif active_vote %}
|
||||
<div class="panel padded" style="margin-top: 20px;">
|
||||
<!-- During the voting period -->
|
||||
{% if user %}
|
||||
{% if user.can_vote() %}
|
||||
<p>Cast your votes until <strong>October 20th</strong> 📅</p>
|
||||
<ul>
|
||||
<li>Videos are presented in random order, and scores are hidden until the voting period ends</li>
|
||||
<li>Your votes are anonymous</li>
|
||||
<li>You can change your votes until the voting period ends</li>
|
||||
<li>We encourage you to vote for as many entries as you can</li>
|
||||
<li>If you found any issue or if you have a suggestion, please create an issue in our <a href="https://github.com/godotengine/godot-showreel-voting/issues">issue tracker</a></li>
|
||||
</ul>
|
||||
|
||||
<p style="margin: 20px 0;">Happy voting!</p>
|
||||
<a class="button primary" id="vote-link" href="/vote">Start Voting</a> <a class="button dim" href="/history">History</a>
|
||||
{% else %}
|
||||
<p>Only Godot Engine maintainers or members of the Development Fund can vote.</p>
|
||||
<p>If you would like to participate in the process, make sure to sign up to <a href="https://fund.godotengine.org">the Development Fund</a>.</p>
|
||||
<p style="margin-top: 20px;">
|
||||
<a href="https://fund.godotengine.org" class="button">Sign Up</a>
|
||||
</p>
|
||||
<p style="margin-top: 20px;">
|
||||
<strong>Already a fund member?</strong><br>
|
||||
If you became a member recently, try to <a href="{{ url_for('oidc.logout') }}">logout</a> and then log in again. Also make sure that you use the same account as you used on the fund page!
|
||||
</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<hr>
|
||||
You need to be logged in to vote:
|
||||
<a href="/login" class="button dim small">Log In</a>
|
||||
{% endif %}
|
||||
|
||||
<h1>Welcome!</h1>
|
||||
<p>The voting period for this years showreel videos has finished.</p>
|
||||
<p style="margin: 20px 0;">Thank you to everyone who participated!</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="panel padded" style="margin-top: 20px;">
|
||||
<p>No showreels just yet!</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="panel padded" style="margin-top: 20px;">
|
||||
<!-- During the submission period -->
|
||||
{% if user %}
|
||||
{% if submission_success %}
|
||||
<p>You can submit multiple entries until <strong>?????</strong> 📅</p>
|
||||
{% else %}
|
||||
<p>Submit your game for the Godot showreel until <strong>?????</strong> 📅</p>
|
||||
{% endif %}
|
||||
<a class="button primary" href="/submit">Submit entry</a>
|
||||
{% else %}
|
||||
You need to be logged in to submit an entry:
|
||||
<a href="/login" class="button dim small">Log In</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="panel padded" style="margin-top: 20px;">
|
||||
<!-- During the voting period -->
|
||||
{% if user %}
|
||||
{% if user.can_vote() %}
|
||||
<p>Cast your votes until <strong>October 20th</strong> 📅</p>
|
||||
<ul>
|
||||
<li>Videos are presented in random order, and scores are hidden until the voting period ends</li>
|
||||
<li>Your votes are anonymous</li>
|
||||
<li>You can change your votes until the voting period ends</li>
|
||||
<li>We encourage you to vote for as many entries as you can</li>
|
||||
<li>If you found any issue or if you have a suggestion, please create an issue in our <a href="https://github.com/godotengine/godot-showreel-voting/issues">issue tracker</a></li>
|
||||
</ul>
|
||||
|
||||
<p style="margin: 20px 0;">Happy voting!</p>
|
||||
<a class="button primary" id="vote-link" href="/vote">Start Voting</a> <a class="button dim" href="/history">History</a>
|
||||
{% else %}
|
||||
<p>Only Godot Engine maintainers or members of the Development Fund can vote.</p>
|
||||
<p>If you would like to participate in the process, make sure to sign up to <a href="https://fund.godotengine.org">the Development Fund</a>.</p>
|
||||
<p style="margin-top: 20px;">
|
||||
<a href="https://fund.godotengine.org" class="button">Sign Up</a>
|
||||
</p>
|
||||
<p style="margin-top: 20px;">
|
||||
<strong>Already a fund member?</strong><br>
|
||||
If you became a member recently, try to <a href="{{ url_for('oidc.logout') }}">logout</a> and then log in again. Also make sure that you use the same account as you used on the fund page!
|
||||
</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<hr>
|
||||
You need to be logged in to vote:
|
||||
<a href="/login" class="button dim small">Log In</a>
|
||||
{% endif %}
|
||||
|
||||
<h1>Welcome!</h1>
|
||||
<p>The voting period for this years showreel videos has finished.</p>
|
||||
<p style="margin: 20px 0;">Thank you to everyone who participated!</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel padded" style="margin-top: 20px;">
|
||||
|
||||
28
templates/partials/vote-results.html
Normal file
28
templates/partials/vote-results.html
Normal file
@@ -0,0 +1,28 @@
|
||||
{% if metrics.total_votes == 0 %}
|
||||
<p>No voting data available for this showreel yet.</p>
|
||||
{% else %}
|
||||
<div>
|
||||
<p>Total votes: <strong>{{ metrics.total_votes }}</strong></p>
|
||||
<p>Positive votes: <strong>{{ metrics.positive_votes }}</strong></p>
|
||||
<p>Negative votes: <strong>{{ metrics.total_votes - metrics.positive_votes }}</strong></p>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
{% endif %}
|
||||
<div>
|
||||
<div class="entries">
|
||||
{% for entry in metrics.results %}
|
||||
<div class="entry panel padded">
|
||||
<h2>
|
||||
<a href="{{ url_for('votes.video_view', video_id=entry.id) }}">
|
||||
{{ entry.game }}
|
||||
</a>
|
||||
</h2>
|
||||
<p>Category: <strong>{{ showreel.title }}</strong></p>
|
||||
<p>Author: <strong>{{ entry.author_name }}</strong></p>
|
||||
<p>Vote sum: <strong>{{ entry.vote_sum }}</strong></p>
|
||||
<p>Votes received: <strong>{{ entry.vote_count }}</strong></p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user