Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added event handlers and a Redux store for cooperation #2061

Merged
merged 44 commits into from
Aug 28, 2024

Conversation

Olenka-Hryk
Copy link
Contributor

@Olenka-Hryk Olenka-Hryk commented Jul 7, 2024

Refactored components by Single Responsibility Principle & added event handlers

The components have been refactored to follow to the SRP and decoupling the storage logic from presentation logic that makes the components to be reusable across different contexts. The refactored approach can be viewed via the following link: https://excalidraw.com/#json=7kpXFBlTDdFpOw4ERottv,BXDnxwSefLtlilkxienKZQ
cooperation-ref

[ PR #2061 ]

Implemented ability to change the availability status in 'My Cooperations' and store this information in the Redux store

Now, all changes to the availability status of resources on ResourceItems are persisted in the store:
Screenshot 2024-08-14 at 19 48 36
When the publish type is set to 'Open manually', the availability of all resources is automatically changed to 'Closed', and these changes are persisted in the store:
Screenshot 2024-08-14 at 19 49 16
Additionally, logic has been implemented to store the sort order of resources as individual items within each section. Previously, sorting was only implemented by group type, specifically for attachments, lessons, and quizzes, which only sorted groups but not the resources within them:
Screenshot 2024-08-14 at 19 51 47

Breaking changes:

[ PR #2168 ]

Combined lessons, quizzes, and attachments into activities array in the cooperation store

Changed the cooperation store to combine the logic of storing attachments (lessons, quizzes, and attachments) into a single variable - activities. Also removed the order field:

Screenshot 2024-08-14 at 20 24 07

[ PR #2290 ]

Refactored Cooperation & Course by Applying Main Requested Changes

Changed the name of the array activities to resources and the type of resources from [lessons, quizzes, attachments, questions] to [lesson, quiz, attachment, question]. Current structure Cooperation and Course:

Screenshot 2024-08-06 at 01 07 24

[ PR #2303 ]

Fixed date serialization and mask input issues in DatePicker component

  • Ensured availability.date is properly serialized to ISO string before dispatching actions:
    A non-serializable value (Date object) was detected in the state, specifically in the path: cooperations.sections.0.resources.0.resource.availability.date. This warning is raised because Redux state should only contain plain serializable objects, arrays, and primitives. The reducer handling this action type is cooperationsSlice/updateResource.
  • Adjusted props for DatePicker component to use fixed-length date parts to resolve mask input warning.

[ PR #2316 ]

Replaced functionality of create course in order to use new handlers

Updated the create course functionality to utilize the new handlers developed in PR #2061 after refactoring. The changes ensure that the course creation process works correctly when adding resources with the required entity data structure, as specified in PR #2290.

[ PR #2334 ]

Fixed [Error 409 (Conflict)] when saving cooperation with empty title or description

Resolved an issue where saving a cooperation with a section that has an empty title or description resulted in an Axios error with the message 'Request failed with status code 409'. After changes, it now shows a proper error popup message.

Tests Coverage for New Code:

Screenshot 2024-07-29 at 20 12 58 Screenshot 2024-07-29 at 20 10 50 Screenshot 2024-07-29 at 20 11 16 Screenshot 2024-07-29 at 20 11 41 Screenshot 2024-08-13 at 11 00 14 Screenshot 2024-08-14 at 16 04 02

🟣 Merged PRs:

🟢 Closed Issues:

Based on this epic Epic: Rewrite cooperation activities #1921, the following issues were implemented:

useEffect(() => {
if (!sections?.length && !isAddedClicked && isNewActivity) {
addNewSection()
}

if (selectedCourse && !sections.length && isAddedClicked) {
if (selectedCourse && !sections?.length && isAddedClicked) {
Copy link
Contributor Author

@Olenka-Hryk Olenka-Hryk Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires further investigation of all the useEffect logic. It will be addressed in issue #2064.

Also, I think we should delete unnecessary user action values (such as isActivityCreated, isAddedClicked, etc.) in the Redux store for Cooperation.

@Olenka-Hryk Olenka-Hryk linked an issue Jul 25, 2024 that may be closed by this pull request
@Olenka-Hryk Olenka-Hryk force-pushed the feature/1919/change-cooperation-date branch from 28ced44 to 0d1f3e7 Compare August 16, 2024 08:39
@D1nviz
Copy link
Contributor

D1nviz commented Aug 16, 2024

Great work!

Copy link
Contributor

@mhevyk mhevyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge work done! Keep going!

…tip, CourseSectionContainer, CooperationActivitiesList
…ation-add-resource-in-two-ways

Added the possibility to add a resource to a Cooperation in two ways: by duplicating or linking
…-create-course-functionality-to-new-handlers

Replaced functionality of create course in order to use new handlers #2070
…main-changes-into-cooperation

Refactored Cooperation & Course by Applying Main Requested Changes
…op-unique-id-section-issue

Fixed drag-and-drop functionality and unique ID generation
…e-already-linked-resources

Disabled already linked resources in Course/Cooperation in choose resources modals
…s-duplicate-icon-update

Updated icon display based on resource addition method (link vs copy)
…-add-resource-in-two-ways

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

Resolved BSONTypeError when adding duplicate resources to Course/Cooperation
…source-in-two-ways-duplicate-and-link

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

@Olenka-Hryk Olenka-Hryk merged commit 68cbb29 into develop Aug 28, 2024
3 checks passed
@Olenka-Hryk Olenka-Hryk deleted the feature/1919/change-cooperation-date branch August 28, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Frontend part priority: medium Tutor Implementation that regard to the tutor
Projects
None yet
7 participants