Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Move CoursePages into Course (first step) #338

Closed
7 of 13 tasks
elbotho opened this issue Apr 19, 2024 · 5 comments · Fixed by #352
Closed
7 of 13 tasks

Move CoursePages into Course (first step) #338

elbotho opened this issue Apr 19, 2024 · 5 comments · Fixed by #352

Comments

@elbotho
Copy link
Member

elbotho commented Apr 19, 2024

Preparation / Checks / Precaution

Alias format

Let's try this format and see if there are problems in any of the concerned will be problems with that:

# course with first page loaded
/{course-id}   
/{subject}/{course-id}/{slug-from-course-title}

# course with the selected course page open indentified by course-page-id
# course-page-id can be a legacy uuid (number) or the first part of a uuidv4 (string)
/{subject}/{course-id}/{course-page-id}/{slug-from-course-page-title}

# the result is not super pretty, but should work:
# /mathe/51979/8b2e4ecf/nullstellen

Tasks of the migration

  • copy the editor state of each CoursePage into the new optional field of the parent Course
  • (also merge solutions like we did in previous migrations)
  • (maybe: if all/most pages have a different license use that license on the course as well)
  • Adapt all repos to handle the new alias format

Course state with exercises:

 {
   "plugin": "course",
   
   "state": {
    
     "content": { ... },
     "pages": [
       {
         "title": …,
         "content": …, // rows plugin
         "id": 
       },
       
     ]
   },
   
 }

Rollout

  • the migration itself can run anytime and should not cause problems in db-layer, api or frontend (only staging for now!)
  • the frontend will then switch to displaying the "state-coursepages" so we can already test the displaying of existing content
  • the frontend has to then only allow creating of new child coursePages inside the state (and not use an extra uuid any more)

follow ups:

  • Add cf-worker redirect from CoursePage to Course (with new url format)

at some point

  • new migration to remove coursePages
  • adapt API etc.

After

  • we can then remove the CoursePage code from all repos (API, db-layer, cf-worker, frontend)
  • and remove all Course and revisions from the db in a follow up db-migration

old related PRs

  • fix: replace links to grouped exercises #308
  • feat: Delete grouped-exercises #316
  • feat: Migrate injections of grouped exercises #275
  • feat: Merge GroupedExercise into ExerciseGroup #257 (and follow ups)- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@kulla
Copy link
Member

kulla commented Apr 24, 2024

Are there CoursePages that belong to more than one Course?

No

mysql> select entity_link.child_id, count(entity_link.parent_id) as nr_parents from entity_link join entity child on child.id = entity_link.child_id join type child_type on child_type.id = child.type_id where child_type.name = "course-page" group by entity_link.child_id having nr_parents > 1;
Empty set (0.05 sec)

@kulla
Copy link
Member

kulla commented Apr 24, 2024

Generate and check list of CoursePage where the license is different than for the Course it belongs to

+----------+------------+------------+
| child_id | license_id | license_id |
+----------+------------+------------+
|    19502 |          1 |         28 |
|    19515 |          1 |         28 |
|    19549 |          1 |         28 |
|    20654 |          1 |         28 |
|    20661 |          1 |         28 |
|    20710 |          1 |         28 |
|    20712 |          1 |         28 |
|    20714 |          1 |         28 |
|    20716 |          1 |         28 |
|    20718 |          1 |         28 |
|    20720 |          1 |         28 |
|    20722 |          1 |         28 |
|    22238 |          1 |         28 |
|    25428 |          1 |         28 |
|    67463 |          1 |         28 |
|    67468 |          1 |         28 |
|    67477 |          1 |         28 |
|    67478 |          1 |         28 |
|   105308 |          1 |         28 |
|    46745 |          1 |         28 |
|    46748 |          1 |         28 |
|    46751 |          1 |         28 |
|    46753 |          1 |         28 |
|    46757 |          1 |         28 |
|    46764 |          1 |         28 |
|    46779 |          1 |         28 |
|    46781 |          1 |         28 |
|    46783 |          1 |         28 |
|    46804 |          1 |         28 |
|    46811 |          1 |         28 |
|    46819 |          1 |         28 |
|    46828 |          1 |         28 |
|    46830 |          1 |         28 |
|    47028 |          1 |         28 |
|    47030 |          1 |         28 |
|    47036 |          1 |         28 |
|    47040 |          1 |         28 |
|    47044 |          1 |         28 |
|    47120 |          1 |         28 |
|    57674 |          1 |         28 |
|    58142 |          1 |         28 |
|    58144 |          1 |         28 |
|    58148 |          1 |         28 |
|    58150 |          1 |         28 |
|    58152 |          1 |         28 |
|    58154 |          1 |         28 |
|    58158 |          1 |         28 |
|    58163 |          1 |         28 |
|    58166 |          1 |         28 |
|    58169 |          1 |         28 |
|    58171 |          1 |         28 |
|    58176 |          1 |         28 |
|    58178 |          1 |         28 |
|    58180 |          1 |         28 |
|    59769 |          1 |         28 |
|    62609 |          1 |         28 |
|    62611 |          1 |         28 |
|    62618 |          1 |         28 |
|    62620 |          1 |         28 |
|    97754 |          1 |         28 |
|    97760 |          1 |         28 |
|    97763 |          1 |         28 |
|    97767 |          1 |         28 |
|    97848 |          1 |         28 |
|   101834 |          1 |         28 |
|   101936 |          1 |         28 |
|   101977 |          1 |         28 |
|   104874 |          1 |         28 |
|   105385 |          1 |         28 |
|   105958 |          1 |         28 |
|   209964 |          1 |         28 |
|   212217 |          1 |         28 |
|   214231 |          1 |         28 |
|   214232 |          1 |         28 |
|   214236 |          1 |         28 |
|   218989 |          1 |         28 |
|   218990 |          1 |         28 |
|   240914 |          1 |         28 |
|   239603 |         21 |         14 |
|   273562 |          1 |         25 |
|   273564 |          1 |         25 |
|   273566 |          1 |         25 |
|   273568 |          1 |         25 |
|   273572 |          1 |         25 |
|   273587 |          1 |         25 |
|   273589 |          1 |         25 |
|   273591 |          1 |         25 |
|   273593 |          1 |         25 |
|   273595 |          1 |         25 |
|   293161 |          1 |         25 |
|   293163 |          1 |         25 |
|   293199 |          1 |         25 |
|   293201 |          1 |         25 |
|   293207 |          1 |         25 |
|   293209 |          1 |         25 |
|   293537 |          1 |         25 |
|   293877 |          1 |         25 |
|   304611 |          1 |         25 |
+----------+------------+------------+
98 rows in set (0.03 sec)

I guess some of them can be changed:

mysql> select entity_link.child_id, child.license_id, child_license.title, parent_license.title, parent.license_id from entity_link join entity child on child.id = entity_link.child_id join entity parent on parent.id = entity_link.parent_id join type child_type on child_type.id = child.type_id join license child_license on child_license.id = child.license_id join license parent_license on parent_license.id = parent.license_id where child_type.name = "course-page" and
 child.license_id != parent.license_id;
+----------+------------+---------------------------------------------------------+---------------------------------------------------+------------+
| child_id | license_id | title                                                   | title                                             | license_id |
+----------+------------+---------------------------------------------------------+---------------------------------------------------+------------+
|   239603 |         21 | Licencia estándar de YouTube                            | Este contenido está licenciado bajo cc-by-sa-4.0  |         14 |
|   273562 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273564 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273566 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273568 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273572 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273587 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273589 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273591 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273593 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   273595 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293161 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293163 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293199 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293201 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293207 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293209 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293537 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   293877 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
|   304611 |          1 | Dieses Werk steht unter der freien Lizenz CC BY-SA 4.0. |                                                   |         25 |
+----------+------------+---------------------------------------------------------+---------------------------------------------------+------------+
20 rows in set (0.03 sec)

@kulla
Copy link
Member

kulla commented Apr 24, 2024

Check for CoursePages that are direct children of a taxonomy

There aren't any:

mysql> select entity_link.child_id from entity_link join term_taxonomy_entity on term_taxonomy_entity.entity_id = entity_link.child_id join entity child on child.id = entity_link.child_id join entity parent on parent.id = entity_link.parent_id join type child_type on child_type.id = child.type_id where child_type.name =
Empty set (0.04 sec)

@kulla
Copy link
Member

kulla commented Apr 24, 2024

Decide if we want to allow a single CoursePage to have a license (or only the Course) (probalby whole course only)

Hopefully we can merge them...

@kulla
Copy link
Member

kulla commented Apr 24, 2024

Prepare a migration that changes all injected (in injection, content, related content) CoursePages so they use the new url format (see first point)

Can be done manually -> there aren't many: https://nbviewer.org/github/serlo/evaluations/blob/main/src/2023/2023-11-02-injection-of-solutions.ipynb#section4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants