marinaglancy / moodle-format_flexsections

25 stars 26 forks source link

Implement weekly layout. #31

Open kabalin opened 2 years ago

kabalin commented 2 years ago

This patch adds an option to format settings that allows emulating weekly format in a way where top level sections will be named after weeks: image

This does not apply to subsections. When in use, the layout is similar to:

image

(notice the patch contains commit from PR #28 which should be merged first)

marinaglancy commented 2 years ago

hi Ruslan, sorry again that it took so long to review

I found a couple of errors in this patch:

  1. When I create a new course and switch format to "Flexible sections" I get warnings

    PHP Notice: Trying to get property 'layout' of non-object in course/format/flexsections/lib.php on line 136, referer: http://localhost/mystuff400/course/edit.php

  2. In fact, I don't understand at all how/where this function get_default_course_enddate() is used - I do not see the "automatic" end date anywhere (like I would see in the weekly course format).

  3. If the course is in the "Flexible sections" format and in the "Weekly" layout I can still highlight random sections and they appear highlighed only during editing, when I refresh the page the highlight jumps back to the current week.

  4. When I edit a section the "Section name" is disabled and disabled text says "Subtopic" (not the week name)

It definitely needs a behat test of creating a new course, switching format to the "Flexible sections" and then layout to "Weekly" and making sure it set the end date correctly

marinaglancy commented 2 years ago

I just added the CRUD behat tests in https://github.com/marinaglancy/moodle-format_flexsections/pull/40 when it's merged, you can rebase your branch and you'll see that these tests are failing because of the PHP errors

kabalin commented 1 year ago

Hi Marina, this has been refactored to support automatic enddate adjustment similar to what weekly format does:

image

All the other issues are also addressed, get_default_course_enddate() is removed completely, it is only used to set an initial end date on format switching, since the default layout is topic, it has no use for us. Issues regarding highlighting and section name at section editing are also fixed and tests were added.