Skip to content

Respect start and end dates of courses + Order course editions

Taico Aerts requested to merge 143-fix-start-and-end-date into development

Course Edition visibility

Course editions will now use their start and end date to automatically be hidden / shown to students. Start and end dates are no longer required. A missing end date means the course does not close, a missing start date means the course is always open. The student will see start to end, Since start, Until end or nothing depending on which dates are available.

The permissions and visibility of course editions is completely changed in this MR.

  • Courses are no longer open or closed, but rather have a normal status (closes at the end date) or a hidden status (only visible to the course staff)
  • Courses have three defined periods: open for enrolment, open for offering projects and active. While these periods themselves are not in this MR, the scopes are there, allowing them to be added later.
  • Courses have three scopes for visibility: visible for students, visible for staff and visible for external. These scopes use more complex queries and take into account the user to determine which courses they should be able to see.

This MR also adds informative placeholders to course edition creation/editing.

The definition of the periods will work as follows:

        Open for enrolment = A - B
Open for offering projects = C - D
                 Starts at = E
                   Ends at = F
                    Active = min(A, C) - F
A <= E
C <= E
B <= F
D <= F

Sorting

Sorting is overhauled and corrected

  • There is a sort_by_name method in the ApplicationRecord base class, allowing all database objects to be sorted by name (those without a name field will fail this). This scope can be overridden in other classes (such as user) if sorting by name should be different.
  • There were some small mistakes in the sorting which have been corrected.

Course editions are ordered by relevance. Relevance is defined as follows:

  1. Course editions with no start date and end date come first
  2. We consider the start date if available or the end date otherwise. We then sort these values descending.
  3. We sort descending by end date (course editions with the ending date furthest in the future are higher)
  4. We sort ascending by name (course editions with the same start and end dates are sorted in alphabetical order).

Permissions

  • Permissions were corrected to use the new visibilities.
  • Permissions now use the form can :read, Course, id: allowed_courses.ids rather than can :read, allowed_courses. This was already used for the admin ability file, and prevents some permissions from not working as expected.

Companies

Projects for companies in my projects and in the company view are now split into two categories, active and archived. Archived projects are only shown when the archived projects panel header is clicked.

Closes #143 (closed) Closes #98 (closed)

Edited by Taico Aerts

Merge request reports