Skip to content

Commit

Permalink
[frontend] Fixing forgotten code that needed to be removed
Browse files Browse the repository at this point in the history
for removing accessibility structure from task import
  • Loading branch information
AlexandreDoneux committed May 16, 2024
1 parent 1a88ba2 commit 42811b0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
3 changes: 0 additions & 3 deletions inginious/frontend/pages/course_admin/task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from natsort import natsorted

from inginious.frontend.pages.course_admin.utils import INGIniousAdminPage
from inginious.frontend.util import dict_data_str_to_datetimes

class CourseTaskListPage(INGIniousAdminPage):
""" List informations about all tasks """
Expand Down Expand Up @@ -38,8 +37,6 @@ def POST_AUTH(self, courseid): # pylint: disable=arguments-differ
task_dispenser = course.get_task_dispenser()
try:
data = task_dispenser.import_legacy_tasks()
for task in data["config"].values():
task["accessibility"] = dict_data_str_to_datetimes(task["accessibility"])
self.update_dispenser(course, data)
except Exception as e:
errors.append(_("Something wrong happened: ") + str(e))
Expand Down
3 changes: 0 additions & 3 deletions inginious/frontend/pages/taskset_admin/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from natsort import natsorted

from inginious.frontend.pages.taskset_admin.utils import INGIniousAdminPage
from inginious.frontend.util import dict_data_str_to_datetimes


class TasksetTemplatePage(INGIniousAdminPage):
Expand Down Expand Up @@ -39,8 +38,6 @@ def POST_AUTH(self, tasksetid): # pylint: disable=arguments-differ
task_dispenser = taskset.get_task_dispenser()
try:
data = task_dispenser.import_legacy_tasks()
for task in data["config"].values():
task["accessibility"] = dict_data_str_to_datetimes(task["accessibility"])
self.update_dispenser(taskset, data)
except Exception as e:
errors.append(_("Something wrong happened: ") + str(e))
Expand Down
24 changes: 0 additions & 24 deletions inginious/frontend/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,3 @@ def dict_data_datetimes_to_str(data):
dict_data_datetimes_to_str(item)
return data


def dict_data_str_to_datetimes(data):
"""
:param data: dict or list data to convert
:return: dict or list with string dates converted to datetime objects
"""
if isinstance(data, dict):
for key, value in data.items():
if isinstance(value, str):
try:
if value == "0001-01-01 00:00:00":
data[key] = datetime.min
elif value == "9999-12-31 23:59:59":
data[key] = datetime.max.replace(microsecond=0)
else:
data[key] = datetime.strptime(value, '%Y-%m-%d %H:%M:%S') if (value != "") else None
except ValueError:
pass # If it's not a valid date string, continue without converting
else:
dict_data_str_to_datetimes(value)
elif isinstance(data, list):
for item in data:
dict_data_str_to_datetimes(item)
return data

0 comments on commit 42811b0

Please sign in to comment.