Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-77130

Add cohort custom fields functionality

    XMLWordPrintable

Details

    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-77130-master-v2
    • Hide
      Basic functionality
      1. Log in as an admin
      2. Go to Site administration / Users / Accounts / Cohort custom fields
      3. Click "Add a new category"
      4. Confirm that a new category "Other fields" is added.
      5. Try to rename this category.
      6. Confirm that you can rename the category.
      7. Refresh the page.
      8. Confirm that the category name remains unchanged.
      9. Click "Add a new custom field"
      10. Confirm that you see the enabled custom field type plugins on the dropdown menu.
      11. Add a custom field of Short text type (set Required and Unique as yes)
      12. Go to Site administration / Users / Accounts / Cohorts
      13. Select Add new cohort and confirm you see created custom fields under Other fields section of the form.
      14. Populate all fields, except the custom field and try to save changes. Confirm that  you can not save as the field is mandatory.
      15. Populate field with 111 and save. Confirm that a new cohort is created.
      16. Click Edit in the dropdown menu for a newly created cohort. Confirm that 111 is set for the custom field in opened edit form. Click cancel.
      17. Select Add new cohort and set category to Category 1, set all fields as you want, but the custom field as 111. Confirm that you can't save the form and you see an error "This value is already used."
      18. Change the custom field value to 222 and save the form. Confirm that a new cohort created.
      19. Click Edit in the dropdown menu for a newly created cohort. Confirm that 222 is set for the custom field in opened edit form.
      Web service 

      Should be covered by unit tests. 

      Show
      Basic functionality Log in as an admin Go to Site administration / Users / Accounts / Cohort custom fields Click " Add a new category " Confirm that a new category "Other fields" is added. Try to rename this category. Confirm  that you can rename the category. Refresh the page. Confirm  that the category name remains unchanged. Click " Add a new custom field " Confirm  that you see the enabled custom field type plugins on the dropdown menu. Add a custom field of Short text type (set Required and Unique as yes) Go to Site administration / Users / Accounts / Cohorts Select Add new cohort and confirm you see created custom fields under Other fields section of the form. Populate all fields, except the custom field and try to save changes. Confirm that  you can not save as the field is mandatory. Populate field with 111 and save. Confirm that a new cohort is created. Click Edit in the dropdown menu for a newly created cohort. Confirm that 111 is set for the custom field in opened edit form. Click cancel. Select Add new cohort and set category to Category 1, set all fields as you want, but the custom field as 111. Confirm that you can't save the form and you see an error "This value is already used." Change the custom field value to 222 and save the form. Confirm that a new cohort created. Click Edit in the dropdown menu for a newly created cohort. Confirm that 222 is set for the custom field in opened edit form. Web service  Should be covered by unit tests. 

    Description

      There is custom fields in core for users and courses, see https://moodledev.io/docs/apis/plugintypes/customfield

      In our case we are working on a complex integration task where cohorts are being used to group students. However, more data for cohort is required to make sure students are attached to correct cohorts. 

      Having custom fields attached to cohorts would make sense in this case. 

      Roughly tasks here:

      • [x] A new admin page for creating cohorts custom fields e.g. /cohort/customfield.php[x]
      • [x] New permissions
      • [x] A new custom fields handler 
      • [x] Update cohort edit form 
      • [x] Update cohort related web services 
      • [x] Update cohort related lib functions
      • [x] Unit tests
      • [x] Behat tests

      Attachments

        1. MDL-77130-10.png
          MDL-77130-10.png
          14 kB
        2. MDL-77130-13.png
          MDL-77130-13.png
          56 kB
        3. MDL-77130-14.png
          MDL-77130-14.png
          18 kB
        4. MDL-77130-17.png
          MDL-77130-17.png
          61 kB
        5. MDL-77130-19.png
          MDL-77130-19.png
          51 kB
        6. MDL-77130-4.png
          MDL-77130-4.png
          24 kB

        Issue Links

          Activity

            People

              dmitriim Dmitrii Metelkin
              dmitriim Dmitrii Metelkin
              Nathan Nguyen Nathan Nguyen
              Ilya Tregubov Ilya Tregubov
              Kevin Percy Kevin Percy
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 50 minutes
                  1d 50m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.