Skip to content

Commit

Permalink
Added ability to not count puzzle towards standings, fixes #116
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Feb 6, 2020
1 parent ac1952b commit 095805a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion huntserver/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def formfield_for_manytomany(self, db_field, request, **kwargs):
return super(PuzzleAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
list_filter = ('hunt',)
fields = ('hunt', 'puzzle_name', 'puzzle_number', 'puzzle_id', 'is_meta',
'is_html_puzzle', 'resource_link', 'link', 'solution_link',
'doesnt_count', 'is_html_puzzle', 'resource_link', 'link', 'solution_link',
'answer', 'extra_data', 'num_pages', 'num_required_to_unlock')
inlines = (UnlockInline, ResponseInline)

Expand Down
18 changes: 18 additions & 0 deletions huntserver/migrations/0043_puzzle_doesnt_count.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2 on 2020-02-06 02:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('huntserver', '0042_auto_20200204_2304'),
]

operations = [
migrations.AddField(
model_name='puzzle',
name='doesnt_count',
field=models.BooleanField(default=False, help_text='Should this puzzle not count towards scoring?'),
),
]
3 changes: 3 additions & 0 deletions huntserver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ class Puzzle(models.Model):
help_text="Is this puzzle a meta-puzzle?")
is_html_puzzle = models.BooleanField(default=False,
help_text="Does this puzzle use an HTML folder as it's source?")
doesnt_count = models.BooleanField(default=False,
help_text="Should this puzzle not count towards scoring?")


def serialize_for_ajax(self):
""" Serializes the ID, puzzle_number and puzzle_name fields for ajax transmission """
Expand Down
4 changes: 3 additions & 1 deletion huntserver/static/huntserver/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ $(document).ready(function() {
var last = 0;
var last_str = "";
$(this).find(".solved").each(function(sub_index) {
if($(this).closest("table").find("th").eq($(this).index()).hasClass("metapuzzle")) {
if($(this).closest("table").find("th").eq($(this).index()).hasClass("nocount")) {
//pass
} else if($(this).closest("table").find("th").eq($(this).index()).hasClass("metapuzzle")) {
meta_result = meta_result + 1;
} else {
result = result + 1;
Expand Down
4 changes: 3 additions & 1 deletion huntserver/templates/progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ <h1>Puzzle Progress</h1>
<th>#</br>P</th>
<th>Last&nbsp;Time</th>
{% for puzzle in puzzle_list %}
<th {% if puzzle.is_meta %} class="metapuzzle" {% endif %} data-id='{{ puzzle.puzzle_id }}'>
<th {% if puzzle.is_meta %} class="metapuzzle" {% endif %}
{% if puzzle.doesnt_count %} class="nocount" {% endif %}
data-id='{{ puzzle.puzzle_id }}'>
{{ puzzle.puzzle_name }}
</th>
{% endfor %}
Expand Down

0 comments on commit 095805a

Please sign in to comment.