Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/apps/api/serializers/competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Meta:
'max_submissions_per_person',
'auto_migrate_to_this_phase',
'hide_output',
'hide_prediction_output',
'hide_score_output',
'leaderboard',
'public_data',
Expand Down Expand Up @@ -125,6 +126,7 @@ class Meta:
'max_submissions_per_person',
'auto_migrate_to_this_phase',
'hide_output',
'hide_prediction_output',
'hide_score_output',
# no leaderboard
'public_data',
Expand Down
2 changes: 1 addition & 1 deletion src/apps/api/serializers/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_data_file(self, instance):

def get_prediction_result(self, instance):
if instance.prediction_result.name:
if instance.phase.hide_output and not instance.phase.competition.user_has_admin_permission(self.context['request'].user):
if (instance.phase.hide_output or instance.phase.hide_prediction_output) and not instance.phase.competition.user_has_admin_permission(self.context['request'].user):
return None
return make_url_sassy(instance.prediction_result.name)

Expand Down
1 change: 1 addition & 0 deletions src/apps/api/views/competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def update(self, request, *args, **kwargs):
name=phase["name"],
description=phase["description"],
hide_output=phase["hide_output"],
hide_prediction_output=phase["hide_prediction_output"],
hide_score_output=phase["hide_score_output"],
competition=Competition.objects.get(id=data['id'])
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.28 on 2025-05-14 19:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('competitions', '0057_phase_hide_score_output'),
]

operations = [
migrations.AddField(
model_name='phase',
name='hide_prediction_output',
field=models.BooleanField(default=False),
),
]
1 change: 1 addition & 0 deletions src/apps/competitions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class Phase(ChaHubSaveMixin, models.Model):
auto_migrate_to_this_phase = models.BooleanField(default=False)
has_been_migrated = models.BooleanField(default=False)
hide_output = models.BooleanField(default=False)
hide_prediction_output = models.BooleanField(default=False)
hide_score_output = models.BooleanField(default=False)

has_max_submissions = models.BooleanField(default=True)
Expand Down
1 change: 1 addition & 0 deletions src/apps/competitions/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
'execution_time_limit',
'auto_migrate_to_this_phase',
'hide_output',
'hide_prediction_output',
'hide_score_output',
]
PHASE_FILES = [
Expand Down
2 changes: 2 additions & 0 deletions src/apps/competitions/tests/unpacker_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
'tasks': [0],
'status': 'Previous',
'hide_output': False,
'hide_prediction_output': False,
'hide_score_output': False,
},
{
Expand All @@ -233,6 +234,7 @@
'status': 'Current',
'is_final_phase': True,
'hide_output': False,
'hide_prediction_output': False,
'hide_score_output': False,
}
]
Expand Down
1 change: 1 addition & 0 deletions src/apps/competitions/unpackers/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def _unpack_phases(self):
'max_submissions_per_person': phase.get('max_submissions', 100),
'auto_migrate_to_this_phase': phase.get('auto_migration', False),
'hide_output': phase.get('hide_output', False),
'hide_prediction_output': phase.get('hide_prediction_output', False),
'hide_score_output': phase.get('hide_score_output', False),
}
execution_time_limit = phase.get('execution_time_limit')
Expand Down
1 change: 1 addition & 0 deletions src/apps/competitions/unpackers/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def _unpack_phases(self):
'max_submissions_per_person': phase_data.get('max_submissions', 100),
'auto_migrate_to_this_phase': phase_data.get('auto_migrate_to_this_phase', False),
'hide_output': phase_data.get('hide_output', False),
'hide_prediction_output': phase_data.get('hide_prediction_output', False),
'hide_score_output': phase_data.get('hide_score_output', False),
}
try:
Expand Down
2 changes: 1 addition & 1 deletion src/static/riot/competitions/detail/submission_modal.tag
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</td>
</tr>
<tr>
<td class="selectable file-download {disabled: !prediction_result}">
<td class="selectable file-download {disabled: !prediction_result}" show="{!opts.hide_prediction_output}">
<a href="{ prediction_result }"><i class="file outline icon"></i>Output from prediction step</a>
</td>
</tr>
Expand Down
11 changes: 11 additions & 0 deletions src/static/riot/competitions/editor/_phases.tag
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@
<input type="checkbox" ref="hide_output">
</div>
</div>
<div class="field">
<div class="ui checkbox">
<label>Hide Prediction Output
<span data-tooltip="Prevent participants from downloading 'Output from prediction step'" data-inverted=""
data-position="bottom center"><i class="help icon circle"></i></span>
</label>
<input type="checkbox" ref="hide_prediction_output">
</div>
</div>
<div class="field">
<div class="ui checkbox">
<label>Hide Score Output
Expand Down Expand Up @@ -664,6 +673,7 @@
set_form_data(phase, self.refs.form)
$(self.refs.auto_migrate).prop('checked', _.get(phase, 'auto_migrate_to_this_phase', false))
self.refs.hide_output.checked = phase.hide_output
self.refs.hide_prediction_output.checked = phase.hide_prediction_output
self.refs.hide_score_output.checked = phase.hide_score_output

// Setting description in markdown editor
Expand Down Expand Up @@ -823,6 +833,7 @@
}
data.auto_migrate_to_this_phase = $(self.refs.auto_migrate).prop('checked')
data.hide_output = self.refs.hide_output.checked
data.hide_prediction_output = self.refs.hide_prediction_output.checked
data.hide_score_output = self.refs.hide_score_output.checked
_.forEach(number_fields, field => {
let str = _.get(data, field)
Expand Down