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

feat: [FC-0047] Calendar synchronization #330

Merged
merged 37 commits into from
Jul 18, 2024

Conversation

# Conflicts:
#	core/src/main/res/values/strings.xml
#	course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt
#	course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt
#	course/src/main/java/org/openedx/course/presentation/dates/CourseDatesScreen.kt
#	course/src/main/java/org/openedx/course/presentation/dates/CourseDatesViewModel.kt
#	course/src/main/java/org/openedx/course/presentation/videos/CourseVideosFragment.kt
#	course/src/test/java/org/openedx/course/presentation/container/CourseContainerViewModelTest.kt
…r_sync

# Conflicts:
#	profile/src/main/java/org/openedx/profile/presentation/calendar/NewCalendarDialogFragment.kt
# Conflicts:
#	app/src/main/java/org/openedx/app/di/ScreenModule.kt
#	core/src/main/java/org/openedx/core/ui/ComposeCommon.kt
#	core/src/main/res/values/strings.xml
#	course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt
#	course/src/main/java/org/openedx/course/presentation/dates/CourseDatesScreen.kt
#	course/src/main/java/org/openedx/course/presentation/dates/CourseDatesViewModel.kt
#	course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt
#	course/src/main/res/values/strings.xml
#	course/src/test/java/org/openedx/course/presentation/dates/CourseDatesViewModelTest.kt
#	profile/src/main/java/org/openedx/profile/presentation/calendar/CalendarAccessDialogFragment.kt
#	profile/src/main/java/org/openedx/profile/presentation/calendar/NewCalendarDialogFragment.kt
# Conflicts:
#	app/src/main/java/org/openedx/app/data/storage/PreferencesManager.kt
#	core/src/main/java/org/openedx/core/data/storage/CorePreferences.kt
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 5, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Jun 5, 2024

Thanks for the pull request, @PavloNetrebchuk!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/openedx-mobile-maintainers. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@HamzaIsrar12
Copy link
Contributor

HamzaIsrar12 commented Jul 10, 2024

Issue 4

The Syncing isn't working properly once the course is unsynced externally.

Calenday.Sync.Change.Date.Issue.mp4

@HamzaIsrar12
Copy link
Contributor

@PavloNetrebchuk That makes sense for the initial view but it should be visible once the state is changed to sync.

@PavloNetrebchuk
Copy link
Contributor Author

There are a couple of issues with this flow:

  • "Demo Course 7" was never synced, but it was placed on the Synced side.
  • "Demo Course 8" wasn't synced initially but appeared after unsyncing other courses.

Calendar.Syning.Issue.mp4

We synchronize all courses that can be synced. The situation in the video looks as if "Demo Course 8" did not synchronize due to an error during the initial sync. We can see this from the synchronization indicator. Therefore, the application synchronized on the second attempt.

@PavloNetrebchuk
Copy link
Contributor Author

@PavloNetrebchuk That makes sense for the initial view but it should be visible once the state is changed to sync.

We show the button as soon as it becomes possible. Before showing it, we need to check the state of all enrolled courses one by one.

@PavloNetrebchuk
Copy link
Contributor Author

The Syncing isn't working properly once the course is unsynced externally.

Calenday.Sync.Change.Date.Issue.mp4

As far as I know, this was not part of our scope of work. @volodymyr-chekyrta Am I right?

@PavloNetrebchuk
Copy link
Contributor Author

The Syncing isn't working properly once the course is unsynced externally.

Calenday.Sync.Change.Date.Issue.mp4

Actually, I think if the user made changes, they have reasons for that. As for me, it's the correct flow.

@HamzaIsrar12
Copy link
Contributor

I have marked the issues for easy reference. 😄

Issue 1: When an API error occurs during sync, the view is not visible. However, this should not happen. We should still display the synced courses and move the others to the unsynced state.

Issue 2: A course should not be in the Synced state if we are not receiving the course dates Or if we encounter an error on it.

Issue 3: From the logs, it appears there was never a call for Demo Course 8, meaning the execution stopped after encountering an error on Demo Course 7. We should ensure the process continues to pass all syncable courses.

Issue 4: I apologize if my hardcoded example was confusing. I was referring to the mobile option "Reset Course Dates," which updates the course dates (also available on the web). In this case, the calendar and course dates will be in an unsynced state and will never be synced with the current logic.

@HamzaIsrar12
Copy link
Contributor

Issue 5

The "Change Sync Options" feature creates a new calendar instance with every change. I think the intended implementation was to replace the existing instance instead.

Change.Calendar.mp4

@HamzaIsrar12
Copy link
Contributor

Issue 6

App Crashes on Calendar Permission Revoked.

Steps to Reproduce:

  • Allow Calendar Permission
  • Sync Courses
  • Remove Calendar Permission from App Settings
  • Navigate to Calendar View and the app will crash

Issue 7

Some UX changes were suggested by the iOS team for the Design Team:

  • It would be nice to have a Snackbar on Sync Complete
  • In case of an empty list in Synced or UnSynced state we should show an Empty State.
  • Just to point it out, The "Relative Dates" section is also missing.

@PavloNetrebchuk
Copy link
Contributor Author

@HamzaIsrar12
Issue 6 has been resolved.

Regarding the other issues mentioned, we understand these concerns. While they are not critical, we are open to considering improvements and will incorporate them into the next pull requests as necessary.

@marcotuts
Copy link
Contributor

Can we find a way to split out suggestions for improvements from gaps in functionality or bugs? It is a bit difficult to follow here what needs to change versus what can be a future enhancement. I will try to re-read this from the top to gather the list of open issues as identified, but if anyone else has a clearer sense of the recap / the latest let me know.

@marcotuts
Copy link
Contributor

marcotuts commented Jul 16, 2024

Issue 1 - The "Syncing X Courses" view does not appear during the initial sync.
Edit: Fixed
Update: The user will see "Syncing 0 Courses" if we show that button before initialization. This can be confusing, so we hide the button.
Result: No change required here I think

Issue 2 & 3 - There are a couple of issues with this flow: "Demo Course 7" was never synced, but it was placed on the Synced side. "Demo Course 8" wasn't synced initially but appeared after unsyncing other courses.

Question 2a: I had a hard time understanding exactly what was happening in the shared video, I didn't catch / see when we triggered the unsync option. Can this be clarified? I'm curious to understand how often we expect this will happen / what triggers this.
Question 2b: Is the broader issue that syncs fail / break when we attempt to change sync settings mid-sync?
Question 2c: Does the system automatically attempt resync (I think that's the csae but want to confirm.
Question 2d: Is the issue of a course that is synced vs unsynced being inaccurately labeled only a problem in the sync settings view or do the course dates tab for those courses also show the wrong status. Is the wrong status shown temporarily while the resync happens or it is permanently incorrect once broken the first time?

Result: Not clear what the impact / scope of this and whether we need to fix ASAP. Questions included above for next steps.

Issue 4 - The Syncing isn't working properly once the course is unsynced externally.

It sounds like we don't properly override any edits you may have made to calendar events edited from the calendar app when you rejoin the app / resync dates. Is that a fair assessment of the impact of this? If so, we can make a ticket for future cleanup of this case, but I dont expect it to be common for someone to edit these calendar events.

Result: Created backlog ticket for this case, not worried about this causing issues in the short term. #365

Issue 5 - The "Change Sync Options" feature creates a new calendar instance with every change. I think the intended implementation was to replace the existing instance instead.

Edit: Confirmed 🐛
Question 5a: I agree we generally want to rename an existing calendar instead of creating a new calendar if possible. If this isn't a simple fix we should create a separate ticket as with issue 4 above. Will wait for development clarity on this. I know in certain cases (ex: renamed calendar outside of application) we can't detect this and would need to "resync" again, but for renames of the calendar name within the app I would expect to have full knowledge of this and be able to simply edit the existing calendar, or delete the old and replace with the new.

Result: pending Question 5a

Issue 6 - App Crashes on Calendar Permission Revoked.
Edit: Fixed
Result: Sounds like this has been fixed in a follow-up.

Issue 7 - Some UX changes were suggested by the iOS team for the Design Team:
It would be nice to have a Snackbar on Sync Complete
In case of an empty list in Synced or UnSynced state we should show an Empty State.
Just to point it out, The "Relative Dates" section is also missing.

Result: I will flag these items to @sdaitzman for future review / updates but I think the first two items above we should consider out of scope of this (snackbar + empty state for synced / unsynced). I think the Relative Dates work might be in a separate PR.

Second list of issues included below as well
Issue 1: When an API error occurs during sync, the view is not visible. However, this should not happen. We should still display the synced courses and move the others to the unsynced state.

Question: Which view isn't visible when an API error occurs? Trying to understand where the user impact is here. Is this only within the sync options view or within the dates tab for a given course as well?

Issue 2: A course should not be in the Synced state if we are not receiving the course dates Or if we encounter an error on it.

Question: A course that isn't synced can be marked unsynced, but is this temporary between attempted resyncs or a permanent issue? This is similar to my question in "issue 2+3" above.

Issue 3: From the logs, it appears there was never a call for Demo Course 8, meaning the execution stopped after encountering an error on Demo Course 7. We should ensure the process continues to pass all syncable courses.

Question: Similar question about resync to other issues above.

Issue 4: I apologize if my hardcoded example was confusing. I was referring to the mobile option "Reset Course Dates," which updates the course dates (also available on the web). In this case, the calendar and course dates will be in an unsynced state and will never be synced with the current logic.

Question: I'm not sure I follow this - Does this mean that when you reset / update course dates we don't automatically trigger an update to the course dates calendar? If not we should create a ticket for this.

@volodymyr-chekyrta
Copy link
Contributor

@PavloNetrebchuk

Issue 1: To double-check. It’s okay that we don’t show the count while syncing, but an API error shouldn’t interrupt the flow.

Issue 2: The course should be in the "Synced" state if the user selected it from the list or enrolled in it.
The API should always return dates. Even if an error occurs during this iteration, the app will try again in 24 hours.

Issue 3: The problem is unclear; @HamzaIsrar12 please provide us with more information.

Issue 4: We ignore manual date changes as we consider them intentional.
However, if the dates are changed on the backend, the application will update them since their checksum will change.

Issue 5: Needs to be fixed 🪲

Issue 6: Fixed.

Issue 7: Some UI updates need to be applied.

@volodymyr-chekyrta
Copy link
Contributor

Issue 1: To double-check. It’s okay that we don’t show the count while syncing, but an API error shouldn’t interrupt the flow.

@HamzaIsrar12, thank you for identifying this tricky case 🙌 . We have confirmed that this is a bug that interrupts the flow.
It will be fixed.

@PavloNetrebchuk
Copy link
Contributor Author

Hello @HamzaIsrar12,
Issue 1: Fixed. Synchronisation wouldn't stop if one of the courses encountered an exception.
Issue 5: Fixed.
Issue 7:
a) An empty state was added to the list.
b) Relative dates will be added in the next PR.
c) It was decided not to add a Snackbar on Sync Complete. I confirmed this with the iOS team.
Let me know if there's anything else you need!

@HamzaIsrar12
Copy link
Contributor

Hey @marcotuts, Thank you for looking into this. To simplify, Issues 1 to 6 were bugs, and Issue 7 was a UX suggestion.


Let's address your questions. To keep it simple, I will skip over the items that have been fixed based on recent comments. 😄

Issue 1: Fixed based on Volodymyr message 🚀

Issue 2 & 3:
The issues should hopefully be resolved with the solution for Issue 1. I only conducted a manual review, so @PavloNetrebchuk , please assist Marco with the followup questions.

Question 2a: I had a hard time understanding exactly what was happening in the shared video, I didn't catch / see when we triggered the unsync option. Can this be clarified? I'm curious to understand how often we expect this will happen / what triggers this.
Question 2b: Is the broader issue that syncs fail / break when we attempt to change sync settings mid-sync?
Question 2c: Does the system automatically attempt resync (I think that's the csae but want to confirm.
Question 2d: Is the issue of a ....

Issue 4:
I will add details in the Ticket once free from the MVP or will close it if not needed. 👍🏻

Result: Created backlog ticket for this case, not worried about this causing issues in the short term. #365
...
Question: I'm not sure I follow this - Does this mean that when you reset / update course dates we don't automatically trigger an update to the course dates calendar? If not we should create a ticket for this.

Issue 5 & 6: Fixed based on Pavlo message 🚀

@HamzaIsrar12
Copy link
Contributor

Thanks you @PavloNetrebchuk for addressing the feedback. ✨ Due to the high priority of our MVP release, I won't be able to verify the changes myself at the moment. 🏎️

@volodymyr-chekyrta , could you please verify the addressed changes so we can proceed with merging this PR?

To answer some of your questions: I compared the Android build with iOS for Issue 2, and it appears they were moving the courses to the unsynced state. You might want to compare both apps on a similar user to see the results.

@volodymyr-chekyrta
Copy link
Contributor

Thanks you @PavloNetrebchuk for addressing the feedback. ✨ Due to the high priority of our MVP release, I won't be able to verify the changes myself at the moment. 🏎️

@volodymyr-chekyrta , could you please verify the addressed changes so we can proceed with merging this PR?

To answer some of your questions: I compared the Android build with iOS for Issue 2, and it appears they were moving the courses to the unsynced state. You might want to compare both apps on a similar user to see the results.

@HamzaIsrar12, sure, I understand the situation with the release.
I'll verify the changes, and we will double-check and provide a demo video for issue 2 with explanations.
If we miss something, we will do a regression after the Relative Dates feature and add fixes.

@PavloNetrebchuk
Copy link
Contributor Author

PavloNetrebchuk commented Jul 17, 2024

Explanation regarding the synchronisation of Demo Course 7 and Demo Course 8. (Issue 2 & 3)

The normal case, the course with dates Sync course that has not yet started
https://github.com/user-attachments/assets/5783bb8c-60df-4c44-8d26-eec02af64256 https://github.com/user-attachments/assets/5ef15c8a-b645-4908-a03c-f35a5c644096

We apologize for the confusion, we did not point this out earlier.
At the moment there is a known issue on the backend with not being able to access course dates on a course that has not yet started.
In this case, it will appear in the Synced list but will not actually be synchronized due to an API error.
This problem will be solved on the API level later.

Copy link
Contributor

@volodymyr-chekyrta volodymyr-chekyrta left a comment

Choose a reason for hiding this comment

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

LGTM

@volodymyr-chekyrta volodymyr-chekyrta merged commit 559c7e4 into openedx:develop Jul 18, 2024
4 checks passed
@openedx-webhooks
Copy link

@PavloNetrebchuk 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@marcotuts
Copy link
Contributor

I created tasks for these API Start Date issues fyi @PavloNetrebchuk , @volodymyr-chekyrta ^

Great to see this merged!

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants