-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[frontend] Changing accessibility and registration data structure #985
base: master
Are you sure you want to change the base?
[frontend] Changing accessibility and registration data structure #985
Conversation
da12b05
to
66ce37e
Compare
Rebase on cf8141c. |
3a5baf4
to
32bbce6
Compare
cf8141c
to
1095603
Compare
32bbce6
to
afc22e5
Compare
Rebase on 1095603. |
9dd5a2e
to
145a9eb
Compare
3ad399c
to
72bb543
Compare
Rebase on 4de3a17. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at this stage that you can extract and movethe i18n changes to another PR so that this one gets clearer.
It seems there is no complete consistency for years "0001-" and "1-".
I would recommend, for the max date, to only work with a "one second" accuracy to avoid troubles between the code, the OS-specific accuracy and pymongo.
I eventually woner if keeping support for the older string format in AccessibleTime
constructor could not make the code (and migration one) more cleaner.
inginious/frontend/templates/task_dispensers_admin/config_items/accessibility.html
Outdated
Show resolved
Hide resolved
inginious/frontend/templates/task_dispensers_admin/config_items/accessibility.html
Outdated
Show resolved
Hide resolved
Some code might need to be rewritten in settings.py : INGInious/inginious/frontend/pages/course_admin/settings.py Lines 24 to 51 in 2306071
The data of the course is accessed through the course_factory :
However, the course is retrieved at the start of the method. We could rewrite a bit to use the course instead of There is also the use of a protected member to use the min and max dates instead of |
Keeping support for the legacy access format and changing the format on saving the settings of a course or task is not as easy as we thought for the moment. As you suggested we can add support in the For example in toc.py, task_config is passed to the jinja template and contains the data of the different tasks. def render_edit(self, template_helper, element, task_data, task_errors):
""" Returns the formatted task list edition form """
config_fields = {
"closed": SectionConfigItem(_("Closed by default"), "checkbox", False),
"hidden_if_empty": SectionConfigItem(_("Hidden if empty"),"checkbox",False)
}
taskset = element if isinstance(element, inginious.frontend.tasksets.Taskset) else None
course = element if isinstance(element, inginious.frontend.courses.Course) else None
task_config = dict_data_datetimes_to_str(self._task_config)
return template_helper.render("task_dispensers_admin/toc.html", element=element, course=course, taskset=taskset,
dispenser_structure=self._toc, dispenser_config=task_config, tasks=task_data,
task_errors=task_errors, config_fields=config_fields) However, when tracing back from where the data comes from we can see it is retrieved from the database here, in course_factory.py, and is never processed by AccessibleTime : def get_course_descriptor_content(self, courseid):
return self._database.courses.find_one({"_id": courseid}) Edit: |
3edaabb
to
d03a4e9
Compare
Adding an "accessible_period" dict to define start and end period.
… accessibility and registration Courses will now use a dictionnary for "accessible_period" and "registration_period" with a start and end element. Tasks will have an "accessibility_period" dict with an extra soft_end element.
…ccessibility/registration structure
Putting boolean and period dict inside one element : "accessibility": {"is_open": bool, "period": {"start": ..., "soft_end": ..., "end": ...}}. This way dispenser_data["config"] init in TableOfContents does not have to be changed.
…nd DB To keep the same structure as the task accessibility (dict with bool and period dict).
…enser Changing access structure of tasks when importing in course template and task edit. Also moving change_access_structure, dict_data_str_to_datetime and dict_data_datetimes_to_str in util file in frontend directory.
… feed Fixing previous commit
+ course_factory method used on taskset_factory
…nto strings Had years with less than 4 digits not transformed into strings with years without leading "0" characters.
Simplifying 4 digit year check + removing empty string check because can only be applied to datetime objects
…seconds Storing as min and max attributes of AccessibleTime when possible. And using dates without microseconds
by adding boolean, empty string and None values
…stration date + fix None value and empty string
…ting settings instead of legacy migration
…egacy update" This reverts commit d03a4e9.
…tasks settings update Previously done when importing legacy tasks
a03bbef
to
dafa720
Compare
Rebase on b3a4095. |
…ructure_to_dict()
for removing accessibility structure from task import
This pull request has as goal the change of accessibility and registration data structure in in the code as well as for the storage in DB and yaml files. The objective is also to store the dates as ISO dates in the database and yaml files. This concerns course accessibility, course registration period and task accessibility.
These accessibilities where previously a single value (accessible/registration for courses and accessibility for tasks) and were structured as follows :
(ex:
"2023-12-06 09:00:00/2023-12-13 09:00:00/2023-12-13 09:00:00"
)We will now only use the dates and use minimal and maximal dates to define the cases where the the courses and tasks are always or never accessible. Those minimal and maximal dates are also used in a custom accessibility when certain dates are not defined. You can for example only define a start date in the form and INGInious will then assume there is no end date to the task and it will always be accessible after the given start date.
TO DO :
[ ] In already existing collections=> not needed