Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2a660b3
task edit functionality added
ihsaan-ullah Aug 12, 2023
889b86a
warning message added
ihsaan-ullah Aug 12, 2023
7df6269
selenium fixed - task update
ihsaan-ullah Aug 12, 2023
5a44856
selenium - conflict removed from create and update
ihsaan-ullah Aug 12, 2023
abae192
dump created with keys
ihsaan-ullah Aug 23, 2023
c78f214
show terms page before files when no terms page in a competition
ihsaan-ullah Aug 23, 2023
aba577a
forum add new post button below posts
ihsaan-ullah Aug 24, 2023
eea3e8e
Merge pull request #1116 from codalab/forum_add_post
Didayolo Aug 24, 2023
37f4190
Merge pull request #1111 from codalab/terms_page
Didayolo Aug 24, 2023
f5f54fd
Merge pull request #1072 from codalab/edit_task
Didayolo Aug 24, 2023
5c71705
Merge pull request #1110 from codalab/dump_with_keys
Didayolo Aug 24, 2023
234380f
in yaml, add keys for tasks when dump is created with keys only
ihsaan-ullah Aug 24, 2023
5edabf6
Merge pull request #1120 from codalab/dump_task_key
Didayolo Aug 25, 2023
8c53807
submission date is shown for newly created submission in submission p…
ihsaan-ullah Aug 26, 2023
a21173f
max submission per person and per day default values added
ihsaan-ullah Aug 26, 2023
6742019
test data upated to match the changes
ihsaan-ullah Aug 26, 2023
c9d5e93
test data upated to match the changes
ihsaan-ullah Aug 26, 2023
f45ed83
test data updated
ihsaan-ullah Aug 26, 2023
faca8fd
Merge pull request #1123 from codalab/default_max_submissions
Didayolo Aug 26, 2023
fbaa974
Merge pull request #1122 from codalab/refresh_date
Didayolo Aug 30, 2023
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
6 changes: 5 additions & 1 deletion src/apps/api/serializers/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class SubmissionCreationSerializer(DefaultUserCreateMixin, serializers.ModelSeri
tasks = serializers.PrimaryKeyRelatedField(queryset=Task.objects.all(), required=False, write_only=True, many=True)
phase = serializers.PrimaryKeyRelatedField(queryset=Phase.objects.all(), required=True)
queue = serializers.PrimaryKeyRelatedField(queryset=Queue.objects.all(), required=False, allow_null=True)
created_when = serializers.DateTimeField(format="%Y-%m-%d %H:%M", required=False)
scores = SubmissionScoreSerializer(many=True, required=False)

class Meta:
model = Submission
Expand All @@ -132,7 +134,9 @@ class Meta:
'tasks',
'fact_sheet_answers',
'organization',
'queue'
'queue',
'created_when',
'scores'
)
extra_kwargs = {
'secret': {"write_only": True},
Expand Down
7 changes: 5 additions & 2 deletions src/apps/api/views/competitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,12 @@ def create_dump(self, request, pk=None):
if not competition.user_has_admin_permission(request.user):
raise PermissionDenied("You don't have access")

# get keys_instead_of_files from request data
keys_instead_of_files = request.data.get('keys_instead_of_files', False)

# arg 1: pk: competition primary key
# arg 2: False: keys_instead_of_files (if false: files will be dowloaded in dumps, if true: only keys)
create_competition_dump.delay(pk, False)
# arg 2: keys_instead_of_files (if false: files will be dowloaded in dumps, if true: only keys)
create_competition_dump.delay(pk, keys_instead_of_files)

serializer = CompetitionCreationTaskStatusSerializer({"status": "Success. Competition dump is being created."})
return Response(serializer.data, status=201)
Expand Down
23 changes: 23 additions & 0 deletions src/apps/competitions/migrations/0037_auto_20230826_0859.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.17 on 2023-08-26 08:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('competitions', '0036_submission_queue'),
]

operations = [
migrations.AlterField(
model_name='phase',
name='max_submissions_per_day',
field=models.PositiveIntegerField(blank=True, default=5, null=True),
),
migrations.AlterField(
model_name='phase',
name='max_submissions_per_person',
field=models.PositiveIntegerField(blank=True, default=100, null=True),
),
]
4 changes: 2 additions & 2 deletions src/apps/competitions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ class Phase(ChaHubSaveMixin, models.Model):
hide_output = models.BooleanField(default=False)

has_max_submissions = models.BooleanField(default=False)
max_submissions_per_day = models.PositiveIntegerField(null=True, blank=True)
max_submissions_per_person = models.PositiveIntegerField(null=True, blank=True)
max_submissions_per_day = models.PositiveIntegerField(default=5, null=True, blank=True)
max_submissions_per_person = models.PositiveIntegerField(default=100, null=True, blank=True)

tasks = models.ManyToManyField('tasks.Task', blank=True, related_name='phases', through='PhaseTaskInstance')

Expand Down
5 changes: 5 additions & 0 deletions src/apps/competitions/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,16 @@ def create_competition_dump(competition_pk, keys_instead_of_files=False):
temp_task_data = {
'index': index
}

for field in TASK_FIELDS:
data = getattr(task, field, "")
# If keys_instead of files is not true and field is key, then skip this filed
if not keys_instead_of_files and field == 'key':
continue
if field == 'key':
data = str(data)
temp_task_data[field] = data

for file_type in PHASE_FILES:
if hasattr(task, file_type):
temp_dataset = getattr(task, file_type)
Expand Down
8 changes: 6 additions & 2 deletions src/apps/competitions/tests/unpacker_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"start_date": "2019-01-01",
"execution_time_limit": 500,
"max_submissions_per_day": 5,
"max_submissions_per_person": 100,
"ingestion_program": "ingestion_program.zip",
"input_data": "evaluation_data.zip",
"scoring_program": "scoring_program.zip",
Expand All @@ -32,6 +33,7 @@
"start_date": "2019-09-30",
"execution_time_limit": 300,
"max_submissions_per_day": 5,
"max_submissions_per_person": 100,
"auto_migration": True,
"ingestion_program": "ingestion_program.zip",
"input_data": "evaluation_data.zip",
Expand Down Expand Up @@ -105,6 +107,7 @@
"description": "Development phase",
"execution_time_limit": 500,
"max_submissions_per_day": 5,
"max_submissions_per_person": 100,
"start": "2019-01-01",
"end": "2019-09-29",
"tasks": [0]
Expand All @@ -114,6 +117,7 @@
"description": "Final phase",
"execution_time_limit": 300,
"max_submissions_per_day": 5,
"max_submissions_per_person": 100,
"auto_migrate_to_this_phase": True,
"start": "2019-09-30",
"tasks": [1]
Expand Down Expand Up @@ -201,7 +205,7 @@
'description': 'Development phase',
'execution_time_limit': 500,
'max_submissions_per_day': 5,
'max_submissions_per_person': None,
'max_submissions_per_person': 100,
'auto_migrate_to_this_phase': False,
'has_max_submissions': True,
'end': datetime.datetime(2019, 9, 29, 0, 0, tzinfo=timezone.now().tzinfo),
Expand All @@ -217,7 +221,7 @@
'description': 'Final phase',
'execution_time_limit': 300,
'max_submissions_per_day': 5,
'max_submissions_per_person': None,
'max_submissions_per_person': 100,
'auto_migrate_to_this_phase': True,
'has_max_submissions': True,
'end': None,
Expand Down
4 changes: 2 additions & 2 deletions src/apps/competitions/unpackers/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def _unpack_phases(self):
'start': get_datetime(phase['start_date']),
'name': phase['label'],
'description': phase.get('description'),
'max_submissions_per_day': phase.get('max_submissions_per_day'),
'max_submissions_per_person': phase.get('max_submissions'),
'max_submissions_per_day': phase.get('max_submissions_per_day', 5),
'max_submissions_per_person': phase.get('max_submissions', 100),
'auto_migrate_to_this_phase': phase.get('auto_migration', False),
}
execution_time_limit = phase.get('execution_time_limit')
Expand Down
4 changes: 2 additions & 2 deletions src/apps/competitions/unpackers/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def _unpack_phases(self):
"description": phase_data.get('description'),
"start": get_datetime(phase_data.get('start')),
"end": get_datetime(phase_data.get('end')),
'max_submissions_per_day': phase_data.get('max_submissions_per_day'),
'max_submissions_per_person': phase_data.get('max_submissions'),
'max_submissions_per_day': phase_data.get('max_submissions_per_day', 5),
'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),
}
Expand Down
4 changes: 2 additions & 2 deletions src/static/js/ours/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ CODALAB.api = {
get_competition_files: pk => {
return CODALAB.api.request('GET', `${URLS.API}competitions/${pk}/get_files/`)
},
create_competition_dump: function (pk) {
return CODALAB.api.request('POST', `${URLS.API}competitions/${pk}/create_dump/`)
create_competition_dump: function (pk, keys_instead_of_files) {
return CODALAB.api.request('POST', `${URLS.API}competitions/${pk}/create_dump/`, {keys_instead_of_files: keys_instead_of_files})
},
/*---------------------------------------------------------------------
Submissions
Expand Down
26 changes: 22 additions & 4 deletions src/static/riot/competitions/detail/_header.tag
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,27 @@
<!-- Manage Competition Modal -->
<div class="ui manage-competition modal" ref="files_modal">
<div class="content">
<button class="ui icon button" onclick="{create_dump}">
<div class="ui dropdown button">
<i class="download icon"></i>
<div class="text">Create Competition Dump</div>
<div class="menu">
<div class="parent-modal item"
onclick="{create_dump.bind(this, true)}">
<!-- true for keys -->
Dump with keys
</div>
<div class="parent-modal item"

onclick="{create_dump.bind(this, false)}">
<!-- false for files -->
Dump with files
</div>
</div>
</div>

<!-- <button class="ui icon button" onclick="{create_dump}">
<i class="download icon"></i> Create Competition Dump
</button>
</button> -->
<button class="ui icon button" onclick="{update_files}">
<i class="sync alternate icon"></i> Refresh Table
</button>
Expand Down Expand Up @@ -201,8 +219,8 @@
self.close_modal = selector => $(selector).modal('hide')
self.show_modal = selector => $(selector).modal('show')

self.create_dump = () => {
CODALAB.api.create_competition_dump(self.competition.id)
self.create_dump = (keys_instead_of_files) => {
CODALAB.api.create_competition_dump(self.competition.id, keys_instead_of_files)
.done(data => {
self.tr_show = true
toastr.success("Success! Your competition dump is being created.")
Expand Down
30 changes: 30 additions & 0 deletions src/static/riot/competitions/detail/_tabs.tag
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,28 @@
data-tab="_tab_page{page.index}">
{ page.title }
</div>
<div if="{competition_has_no_terms_page()}" class="item"
data-tab="_tab_page_term">
Terms
</div>
<div class="{active: _.get(competition.pages, 'length') === 0} item" data-tab="files">
Files
</div>
</div>
</div>
<div class="twelve wide column">
<!-- Competition Pages -->
<div each="{ page, i in competition.pages }" class="ui {active: i === 0} tab"
data-tab="_tab_page{page.index}">
<div class="ui" id="page_{i}">
</div>
</div>
<!-- Terms page -->
<div if="{competition_has_no_terms_page()}" class="ui tab" data-tab="_tab_page_term">
<div class="ui" id="page_term">
</div>
</div>
<!-- Files -->
<div class="ui tab {active: _.get(competition.pages, 'length') === 0}" data-tab="files">
<div class="ui" id="files">
<table class="ui celled table">
Expand Down Expand Up @@ -327,6 +338,13 @@
});

})
if(self.competition_has_no_terms_page()){
const rendered_content = renderMarkdownWithLatex(self.competition.terms)
$(`#page_term`)[0].innerHTML = ""
rendered_content.forEach(node => {
$(`#page_term`)[0].appendChild(node.cloneNode(true)); // Append each node
});
}
_.forEach(self.competition.phases, (phase, index) => {
// Render phase description
const rendered_content = renderMarkdownWithLatex(phase.description)
Expand All @@ -341,6 +359,18 @@
}, 500)
})

self.competition_has_no_terms_page = function () {
var no_term_page = true
if(self.competition.pages){
self.competition.pages.forEach(function (page) {
if (page.title === "Terms") {
no_term_page = false
}
})
}
return no_term_page
}

CODALAB.events.on('phase_selected', function (selected_phase) {
self.selected_phase = selected_phase
self.update()
Expand Down
Loading