praxisdigital / moodle-block_sharing_cart

plug-in for Moodle LMS
0 stars 3 forks source link

Performance issue when copy an item to sharing with a site with large database #118

Closed sampraxis closed 9 months ago

sampraxis commented 9 months ago

Solution: Move the business logic to the an adhoc task.

Related issues: praxisdigital/moodle-block_sharing_cart#105 praxisdigital/moodle-block_sharing_cart#117

### Tasks
- [ ] https://github.com/praxisdigital/moodle-block_sharing_cart/issues/119
sampraxis commented 9 months ago

Ready for testing.

Notes before testing

Test instructions for #118

Test 1 - asynchronous mode without user data.

  1. Set setting block_sharing_cart/backup_mode to "Asynchronous".
  2. Set setting block_sharing_cart/restore_mode to "Asynchronous".
  3. Create a new course or reuse one of the courses (Course A).
  4. Add block_sharing_cart block.
  5. Create a new course module or reuse one of the course modules.
  6. Copy a course module from a course to sharing cart.
  7. Expect sharing cart item text to be muted (grey or lighter color) and Copy to course to be hidden (If ad hoc task happens to run instantly, the button be appear in the item).
  8. Wait till ad hoc task (block_sharing_cart_async_backup_course_module) is completed or run it manually /admin/tool/task/adhoctasks.php
  9. Create a new course (Course B).
  10. Add block_sharing_cart block to the new course.
  11. Press Copy to course button and place it into the course.
  12. Expect item not to be appear instantly.
  13. See if ad hoc task (block_sharing_cart_async_restore_course_module) is still in the queue. If it is, run it manually in /admin/tool/task/adhoctasks.php.
  14. Go back the course or reload the course page (Course B).
  15. Expect the item that has been copied appear in the course (Course B).

Test 2 - Test asynchronous mode with user data.

The procedure is the same as "Test 1". But this times the course module type should be checked in the admin setting block_sharing_cart/userdata_copyable_modtypes. When you copy the course module to the sharing cart select that you want to include the user data.

Test 3 - immediate mode without user data. (Original behavior)

  1. Set setting block_sharing_cart/backup_mode to "Immediate".
  2. Set setting block_sharing_cart/restore_mode to "Immediate".
  3. Create a new course or reuse one of the courses (Course A).
  4. Add block_sharing_cart block.
  5. Create a new course module or reuse one of the course modules.
  6. Copy a course module from a course to sharing cart.
  7. Expect the course module to be appear in the sharing cart immediately (After HTTP request is done).
  8. Create a new course (Course B).
  9. Add block_sharing_cart block to the new course.
  10. Press Copy to course button and place it into the course.
  11. Expect the item that has been copied appear in the course (Course B).

Test 4 - Do the same thing with section copy.

Test instructions for #119

  1. Create a new course or reuse one of the courses (Course A).
  2. Add mod_label (Label A) with the a content that is longer than 100 characters.
  3. Add mod_label (Label B) with the a content that is less than 100 characters or just 10 characters.
  4. Add block_sharing_cart block.
  5. Add both labels into the sharing cart block.
  6. Expect sharing cart item name (Label A) to be around 97 characters with 3 dots.
  7. Expect sharing cart item name (Label B) to be the same.
neeesn commented 9 months ago
  1. Når man kopiere en sektion til delekurven i delekurven skal den være grå, så man kan se den kopiere hele sektionen ud. Lige nu er det kun aktiviteterne i sektionen der er grå, når den åbnes i delekurven, når der kopieres. image

  2. Den skal lytte på hvornår den er færdig med at kopiere og ændre farven fra grå til sort, ellers vil nogle kunder sidde og vente meget længe.

  3. Når man indsætter asynkront skal der komme en besked/markering om at man er ved at kopiere data ind i kurset fra delekurven. Der er ingen indikator på dette nu.

  4. Kommer man til at kopiere samme sektion ind i kurven ser det ud til der er en CSS fejl og den nummerere de kommente kopier forkert. image

sampraxis commented 9 months ago

@neeesn Ready for testing

Test with some label with very text as well. See if it trim text out if it exceed 100 characters.

sampraxis commented 9 months ago

We have an issue in upgrade progress. When sharing cart record content user id that is no longer exists in the system, it cause upgrade to failed.

sampraxis commented 9 months ago

Plan on release to Niels Brock today @ 16:00