diff --git a/apps/challenges/migrations/0113_challenge_disable_private_submission.py b/apps/challenges/migrations/0113_challenge_disable_private_submission.py new file mode 100644 index 0000000000..90d0c76807 --- /dev/null +++ b/apps/challenges/migrations/0113_challenge_disable_private_submission.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.20 on 2024-08-31 06:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('challenges', '0112_challenge_sqs_retention_period'), + ] + + operations = [ + migrations.AddField( + model_name='challenge', + name='disable_private_submission', + field=models.BooleanField(default=False), + ), + ] diff --git a/apps/challenges/models.py b/apps/challenges/models.py index 7539627878..ec660c04d4 100644 --- a/apps/challenges/models.py +++ b/apps/challenges/models.py @@ -222,6 +222,7 @@ def __init__(self, *args, **kwargs): ) worker_image_url = models.CharField(max_length=200, blank=True, null=True, default="") evaluation_module_error = models.TextField(null=True, blank=True) + disable_private_submission = models.BooleanField(default=False) class Meta: app_label = "challenges" diff --git a/apps/challenges/serializers.py b/apps/challenges/serializers.py index 6d81932c15..956c1c09a6 100644 --- a/apps/challenges/serializers.py +++ b/apps/challenges/serializers.py @@ -94,7 +94,8 @@ class Meta: "evaluation_module_error", "worker_image_url", "worker_instance_type", - "sqs_retention_period" + "sqs_retention_period", + "disable_private_submission" ) @@ -311,7 +312,8 @@ class Meta: "ephemeral_storage", "evaluation_module_error", "worker_image_url", - "sqs_retention_period" + "sqs_retention_period", + "disable_private_submission" ) diff --git a/docs/source/configuration.md b/docs/source/configuration.md index 7ab0d0860d..f72e8645bf 100644 --- a/docs/source/configuration.md +++ b/docs/source/configuration.md @@ -51,6 +51,8 @@ Following fields are required (and can be customized) in the [`challenge_config. 3. `metadata`: This field defines additional information about the metrics that are used to evaluate the challenge submissions. +- **disable_private_submission**: True/False (a Boolean field that gives the flexibility to Challenge Hosts to either disable or enable private submissions. Default is `False`) + The leaderboard schema for the [sample challenge configuration](https://github.com/Cloud-CV/EvalAI-Starters/blob/master/challenge_config.yaml) looks like this: ```yaml diff --git a/frontend/src/js/controllers/challengeCtrl.js b/frontend/src/js/controllers/challengeCtrl.js index c8bf18a82b..1b156abf2e 100644 --- a/frontend/src/js/controllers/challengeCtrl.js +++ b/frontend/src/js/controllers/challengeCtrl.js @@ -82,7 +82,7 @@ vm.currentPhaseLeaderboardPublic = false; vm.eligible_to_submit = false; vm.evaluation_module_error = null; - + vm.disable_private_submission = false; vm.filter_all_submission_by_team_name = ''; vm.filter_my_submission_by_team_name = ''; // show loader @@ -396,6 +396,7 @@ vm.has_sponsors = details.has_sponsors; vm.queueName = details.queue; vm.evaluation_module_error = details.evaluation_module_error; + vm.disable_private_submission = details.disable_private_submission; vm.getTeamName(vm.challengeId); if (vm.page.image === null) { vm.page.image = "dist/images/logo.png"; @@ -708,6 +709,9 @@ formData.append("project_url", vm.projectUrl); formData.append("publication_url", vm.publicationUrl); formData.append("submission_metadata", JSON.stringify(vm.metaAttributesforCurrentSubmission)); + if (vm.disable_private_submission) { + vm.isPublicSubmission = true; + } if (vm.isPublicSubmission !== null) { formData.append("is_public", vm.isPublicSubmission); } @@ -2836,7 +2840,48 @@ $mdDialog.hide(); } }; - + vm.toggleDisablePrivateSubmission = function(ev) { + ev.stopPropagation(); + vm.toggleSubmissionState = null; + vm.submissionDesc = null; + if (vm.disable_private_submission) + vm.toggleSubmissionState = "allowed"; + else + vm.toggleSubmissionState = "disabled"; + + var confirm = $mdDialog.confirm() + .title('Make private submissions ' + vm.toggleSubmissionState + '?') + .ariaLabel('') + .targetEvent(ev) + .ok('Yes') + .cancel('No'); + + $mdDialog.show(confirm).then(function() { + parameters.url = "challenges/challenge_host_team/" + vm.page.creator.id + "/challenge/" + vm.page.id; + parameters.method = 'PATCH'; + parameters.data = { + "disable_private_submission": !vm.disable_private_submission, + }; + vm.disable_private_submission = !vm.disable_private_submission; + parameters.callback = { + onSuccess: function(response) { + var status = response.status; + if (status === 200) { + $mdDialog.hide(); + $rootScope.notify("success", "Private submissions were successfully made " + vm.toggleSubmissionState); + } + }, + onError: function(response) { + $mdDialog.hide(); + var error = response.data; + $rootScope.notify("error", error); + } + }; + utilities.sendRequest(parameters); + }, function() { + // Nope + }); + }; vm.publishChallenge = function(ev) { ev.stopPropagation(); vm.toggleChallengeState = null; diff --git a/frontend/src/views/web/challenge/challenge-page.html b/frontend/src/views/web/challenge/challenge-page.html index dd6373771a..c9a5825eff 100644 --- a/frontend/src/views/web/challenge/challenge-page.html +++ b/frontend/src/views/web/challenge/challenge-page.html @@ -56,6 +56,18 @@
Select submission visibility:
--private
or --public
flag in the submission
+ --private
or --public
flag in the submission
command to make the submission private or public respectively.