Skip to content

Commit

Permalink
[plugins/contests] Adapting contest plugin to new access structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDoneux committed Jan 11, 2024
1 parent 52c71b3 commit d2dfebf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions inginious/frontend/plugins/contests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def check_dispenser_data(self, dispenser_data):
def get_accessibilities(self, taskids, usernames): # pylint: disable=unused-argument
contest_data = self.get_contest_data()
if contest_data['enabled']:
return {username: {taskid: AccessibleTime(contest_data['start'] + '/') for taskid in taskids} for username in usernames}
accessibility = {"start": contest_data['start'], "end": contest_data['end']}
return {username: {taskid: AccessibleTime(accessibility) for taskid in taskids} for username in usernames}
else:
return TableOfContents.get_accessibilities(self, taskids, usernames)

Expand Down Expand Up @@ -221,17 +222,17 @@ def POST_AUTH(self, courseid): # pylint: disable=arguments-differ
contest_data['end'] = new_data["end"]

try:
start = datetime.strptime(contest_data['start'], "%Y-%m-%d %H:%M:%S")
contest_data['start'] = datetime.strptime(contest_data['start'], "%Y-%m-%d %H:%M:%S")
except:
errors.append('Invalid start date')

try:
end = datetime.strptime(contest_data['end'], "%Y-%m-%d %H:%M:%S")
contest_data['end'] = datetime.strptime(contest_data['end'], "%Y-%m-%d %H:%M:%S")
except:
errors.append('Invalid end date')

if len(errors) == 0:
if start >= end:
if contest_data['start'] >= contest_data['end']:
errors.append('Start date should be before end date')

try:
Expand Down

0 comments on commit d2dfebf

Please sign in to comment.