Skip to content

Commit

Permalink
cleaning for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDoneux committed Dec 14, 2023
1 parent e409275 commit 3a5baf4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 21 deletions.
13 changes: 0 additions & 13 deletions inginious/frontend/course_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
""" Factory for loading courses from disk """

from pymongo import ReturnDocument
from datetime import datetime

from inginious.frontend.log import get_course_logger

Expand All @@ -15,8 +14,6 @@
from inginious.frontend.util import change_access_structure, dict_data_str_to_datetimes




class CourseFactory(object):
""" Load courses from disk """

Expand Down Expand Up @@ -102,11 +99,6 @@ def _migrate_legacy_courses(self):
if taskset.is_legacy() and not self._database.courses.find_one({"_id": tasksetid}):
courseids.append(tasksetid)

# look here for bad accessibilitY structure ??? -> _migrate_legacy_courses detect the courses whithout taskset (taskset id in DB and correct taskset yaml file)
# I can maybe also checko here if the taskset file has the right structure (task accessibilities).

# where to check for DB structure ?

for courseid in courseids:
get_course_logger(courseid).warning("Trying to migrate legacy course {}.".format(courseid))

Expand All @@ -127,13 +119,8 @@ def _migrate_legacy_courses(self):
if "registration" in taskset_descriptor:
taskset_descriptor["registration"] = change_access_structure(taskset_descriptor["registration"])

# here transform task accessibilities ? -> no, it will be done during the migration of the taskset (import_legacy_tasks)
# task accessibilities are not in the course descriptor, but in the tasks descriptors (task.yaml)

taskset_descriptor = dict_data_str_to_datetimes(taskset_descriptor)
#cleaned_taskset_descriptor = dict_data_str_to_datetimes(cleaned_taskset_descriptor)
self._database.courses.update_one({"_id": courseid}, {"$set": taskset_descriptor}, upsert=True)
# why not set cleaned_taskset_descriptor ? -> parce qu'on transmet le taskset_descriptor pour l'enregistrer en DB
self._taskset_factory.update_taskset_descriptor_content(courseid, cleaned_taskset_descriptor)
except TasksetNotFoundException as e:
get_course_logger(courseid).warning("No migration from taskset possible for courseid {}.".format(courseid))
Expand Down
2 changes: 0 additions & 2 deletions inginious/frontend/pages/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from flask import redirect, url_for
from flask.views import MethodView
from werkzeug.exceptions import NotFound, NotAcceptable
from datetime import datetime

from inginious.client.client import Client
from inginious.common import custom_yaml
Expand Down Expand Up @@ -365,4 +364,3 @@ def register_utils(database, user_manager, template_helper: TemplateHelper):
current_users, name, id, placeholder,
single)
)

2 changes: 1 addition & 1 deletion inginious/frontend/plugins/contests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, task_list_func, dispenser_data, database, course_id):
TableOfContents.__init__(self, task_list_func, dispenser_data.get("toc_data", {}), database, course_id)
self._contest_settings = dispenser_data.get(
'contest_settings',
{"enabled": False, # enabled false ?
{"enabled": False,
"start": datetime.now(),
"end": datetime.now() + timedelta(hours=1),
"blackout": 0,
Expand Down
2 changes: 0 additions & 2 deletions inginious/frontend/task_dispensers/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import copy
import inginious
from collections import OrderedDict
from datetime import datetime

from functools import reduce
from operator import concat
Expand Down Expand Up @@ -72,7 +71,6 @@ def get_group_submission(self, taskid):

def get_accessibilities(self, taskids, usernames):
""" Get the accessible time of this task """

return {username: {taskid: AccessibleTime(Accessibility.get_value(self._task_config.get(taskid, {})))
for taskid in taskids } for username in usernames}

Expand Down
2 changes: 0 additions & 2 deletions inginious/frontend/task_dispensers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
import copy
from datetime import datetime

from abc import ABCMeta, abstractmethod
Expand Down Expand Up @@ -375,7 +374,6 @@ def parse_tasks_config(task_list, config_items, data):

def check_task_config(task_list, config_items, data):
"""
:param data: the raw content of the task settings
:return: (True, '') if the settings are valid or (False, The error message) otherwise
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
var taskid = button.data('taskid');
if (!("accessibility" in dispenser_config[taskid]))
return;
//general_taskid = taskid
var accessibility = dispenser_config[taskid]["accessibility"];
var value;

Expand Down

0 comments on commit 3a5baf4

Please sign in to comment.