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

Allow duplicate badge names

XMLWordPrintable

    • MOODLE_25_STABLE, MOODLE_29_STABLE, MOODLE_34_STABLE, MOODLE_39_STABLE
    • MOODLE_405_STABLE
    • MDL-43938-main
    • Hide
      1. Create a backup with all activities, badges and user data of the course which contains the badges you want to import.
      2. Restore the course backup to a new course, restoring the users as manual accounts.
      3. Delete the enrolled users. You can use the participants bulk action "Delete selected user enrolments".
      4. Reset the activities which will contained user data from the previous course (quiz attempts, forum posts, feedback responses...)

       

      After doing it, the badges will exist in the restored course, disabled but with images, criteria and 0 recipients.

      With the previous steps, the uniqueness is not preserved because the badges are restored using the same names on the original course. However, if you need to change some information (such as the issuer), you'll need to change also the badge name (at least for now). 

      Show
      Create a backup with all activities, badges and user data of the course which contains the badges you want to import. Restore the course backup to a new course, restoring the users as manual accounts. Delete the enrolled users. You can use the participants bulk action "Delete selected user enrolments". Reset the activities which will contained user data from the previous course (quiz attempts, forum posts, feedback responses...)   After doing it, the badges will exist in the restored course, disabled but with images, criteria and 0 recipients. With the previous steps, the uniqueness is not preserved because the badges are restored using the same names on the original course. However, if you need to change some information (such as the issuer), you'll need to change also the badge name (at least for now). 
    • Hide

      Mostly covered by PHPUnit and behat tests.

      Testing scenario: Redirect is working for badges/newbadge.php

      1. Login as admin.
      2. Create a course and annotate the course id (<COURSEID>).
      3. Go to https://yourmoodlesite/badges/newbadge.php?id=<COURSEID>
      4. Check you're redirected to https://yourmoodlesite/badges/edit.php?courseid=<COURSEID>&action=new
      5. Check the following message is displayed "The badges/newbadge.php page has been deprecated. Please, use badges/edit.php instead.".
      6. Go to https://yourmoodlesite/badges/newbadge.php
      7. Check you're redirected to https://yourmoodlesite/badges/edit.php?courseid=0&action=new
      8. Check the following message is displayed "You have been redirected from badges/newbadge.php. Please note that badges/newbadge.php will be removed in the near future.".

       

       

      ------------------------------

      THE FOLLOWING MANUAL TESTING IS NOT REQUIRED (because is covered by automated tests).
      However, these are the steps for manually testing it.

      Setup

      1. Download the attached MDL-43938.feature.
      2. Run the following command to create a course with a few badges:

        php admin/tool/generator/cli/runtestscenario.php --feature="absolute/path/to/file.feature"
        

      It might fail while creating the users if they already exist in your local instance. If that's the case, this error can be ignored.
      If  MDL-82162  hasn't been integrated yet, I recommend using the UI to load it (instead of CLI). This feature can be found in "Site administration > Development > Create testing scenarios".
       

      Manual test

      1. Login as admin.
      2. Go to the course "MDL-43938-test" and access Badges.
      3. Try to create a new badge named "Published course badge".
      4. Check ** the badge is saved and that no error is displayed.
      5. Go to "Site administration > Badges > Manage Badges" (/badges/index.php?type=1).
      6. Click the "Add a new badge" button.
      7. Try to create a new badge named "Published course badge".
      8. Check the badge is saved after clicking the "Create badge" button.
      Show
      Mostly covered by PHPUnit and behat tests. Testing scenario: Redirect is working for badges/newbadge.php Login as admin. Create a course and annotate the course id (<COURSEID>). Go to https://yourmoodlesite/badges/newbadge.php?id= <COURSEID> Check you're redirected to https://yourmoodlesite/badges/edit.php?courseid= <COURSEID>&action=new Check the following message is displayed "The badges/newbadge.php page has been deprecated. Please, use badges/edit.php instead.". Go to https://yourmoodlesite/badges/newbadge.php Check you're redirected to https://yourmoodlesite/badges/edit.php?courseid=0&action=new Check the following message is displayed "You have been redirected from badges/newbadge.php. Please note that badges/newbadge.php will be removed in the near future.".     ------------------------------ THE FOLLOWING MANUAL TESTING IS NOT REQUIRED (because is covered by automated tests). However, these are the steps for manually testing it. Setup Download the attached MDL-43938.feature . Run the following command to create a course with a few badges: php admin/tool/generator/cli/runtestscenario.php --feature="absolute/path/to/file.feature" It might fail while creating the users if they already exist in your local instance. If that's the case, this error can be ignored. If   MDL-82162   hasn't been integrated yet, I recommend using the UI to load it (instead of CLI). This feature can be found in "Site administration > Development > Create testing scenarios".   Manual test Login as admin. Go to the course " MDL-43938 -test" and access Badges. Try to create a new badge named "Published course badge". Check ** the badge is saved and that no error is displayed. Go to "Site administration > Badges > Manage Badges" (/badges/index.php?type=1). Click the "Add a new badge" button. Try to create a new badge named "Published course badge". Check the badge is saved after clicking the "Create badge" button.
    • 3
    • HQ 2024 Sprint I2.2 Moppies

      Is there anyway the badges can no longer be "unique" and we could use the same badge across multiple courses? Basically include it as an option when we do imports? Or at least allow non-student roles to re-create the same badge in another course.

      I often teach two sections of the same course, or teach a similar course from term to term so would like to re-use badges when I can.

        1. MDL-43938_message.png
          MDL-43938_message.png
          40 kB
        2. MDL-43938_validationerror.png
          MDL-43938_validationerror.png
          39 kB
        3. MDL-43938.feature
          6 kB
        4. MDL-43938- 1.png
          MDL-43938- 1.png
          160 kB
        5. MDL-43938 - 2.png
          MDL-43938 - 2.png
          268 kB

            Votes:
            88 Vote for this issue
            Watchers:
            85 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 days, 6 hours, 44 minutes
                4d 6h 44m

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