ita-social-projects / SpaceToStudy-Client

MIT License
22 stars 14 forks source link

Added the possibility to add a resource to a Cooperation / Course in two ways: by duplicating or linking #2358

Closed Olenka-Hryk closed 2 months ago

Olenka-Hryk commented 2 months ago

Link: https://excalidraw.com/#json=7kpXFBlTDdFpOw4ERottv,BXDnxwSefLtlilkxienKZQ

[ PR #2358 ]

Integrated the CheckboxWithTooltip component into the modal windows for adding new resources in the Course and Cooperation [ Close #2345 ]

Integrated the CheckboxWithTooltip component (that was developed in PR #2333 ) into the modal windows for adding new resources in the Course and Cooperation:

Screenshot 2024-08-19 at 13 31 54

[ PR #2365 ]

Added the possibility to add a resource to a Cooperation in two ways: by duplicating or linking

Added the possibility for a user to add a resource only once as a link and multiple times as a copy of the current resource.

[ PR #2369 ]

Added the possibility to add a resource to a Course in two ways: by duplicating or linking

Added the possibility for a user to add a resource only once as a link and multiple times as a copy of the current resource.

[ PR #2372 ]

Updated icon display for resources added via Link & Duplicate Copy

[ PR #2379 ]

Disabled already linked resources in Course/Cooperation in choosing resources modals

Users are now prevented from duplicating links when adding resources to a course or cooperation. The modal for selecting resources displays a list of available resources, including those already added as links to the course or cooperation. Resources that have already been added as links are disabled, allowing users to add only new resources:

Screenshot 2024-08-22 at 16 22 36

[ PR #2388 ]

Fixed drag-and-drop functionality and unique ID generation issues

The drag-and-drop functionality for rearranging sections in Courses and Cooperations is now working properly. Additionally, when a course or cooperation has more than two sections, the generated IDs are unique, which resolves the issue where deleting one section would lead to the deletion of all sections within the course or cooperation The implemented changes now properly handle unique IDs and correctly update the order of sections:

Screenshot 2024-08-25 at 17 49 11

[ PR #2392 ]

Fixed "Cast to ObjectId failed" error when adding duplicate resource to Course & Cooperation

Previously, when adding a resource as a duplicate copy to a Course or Cooperation and trying to Save, a "Cast to ObjectId failed" error occurs due to a BSONTypeError. This issue prevented the resource from being properly saved in the database. To resolve the "Cast to ObjectId failed" error when adding duplicate resources, the following changes were implemented:

Screenshot 2024-08-26 at 16 45 38

To resolve this issue, it _was decided not to generate _id using uuidv4() for new resources_, as was previously implemented. Since we use the useDndSensor hook, which only accepts an id, we need to generate an id for every resource added to a Cooperation or Course.

Resource Addition Scenarios:

In response, we receive:

Additionally:

Tests Coverage for New Code:

Screenshot 2024-08-26 at 14 02 31 Screenshot 2024-08-21 at 18 11 04 Screenshot 2024-08-26 at 13 26 58 Screenshot 2024-08-21 at 15 40 38 Screenshot 2024-08-22 at 01 04 38 Screenshot 2024-08-24 at 17 58 12

#

🟣 Merged PRs:

#

🟢 Closed Issues:

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
95.2% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud