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

Fixed marking converted projects as old GD projects #5909

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Jan 11, 2024

Closes #5903

Why is this the best possible solution? Were any other approaches considered?

The problem was the way we implemented marking projects as old GD projects see: https://github.com/getodk/collect/pull/5909/files#diff-a091971b93c91fe4e50308d51b4b3abebac66e51711552f955e75feb504ea928L30
it worked well with existing tests because they used test implementation of ProjectsRepository and simply updating the objects stored on a list (not in shared prefs) worked well.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This is a small fix so we can focus on testing the scenario described in the issue. I don't think there is any bigger risk here.

Do we need any specific form for testing your changes? If so, please attach one.

No.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@grzesiek2010 grzesiek2010 requested a review from seadowg January 11, 2024 22:33
@grzesiek2010 grzesiek2010 marked this pull request as ready for review January 11, 2024 22:33
Copy link
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

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

An alternative solution I think would be worth considering is to add a test in ProjectsRepositoryTest (the "contract" test) to cover the difference in behaviour between the two implementations and then get that passing. Then you can continue to use the fake rather than the real implementation in tests.

What do you think?

@grzesiek2010
Copy link
Member Author

An alternative solution I think would be worth considering is to add a test in ProjectsRepositoryTest (the "contract" test) to cover the difference in behaviour between the two implementations and then get that passing. Then you can continue to use the fake rather than the real implementation in tests.
What do you think?

I don't think the bug we had was something I could test using ProjectsRepositoryTest. The problem was that isOldGoogleDriveProject was a variable that we were able to change and assume it updates the saved project no matter if it's stored using shared prefs or a list in memory (InMemProjectsRepository), of course it didn't work with shared prefs. I've updated isOldGoogleDriveProject so that now it's val and I think we can revert the changes in tests.

@grzesiek2010 grzesiek2010 requested a review from seadowg January 17, 2024 12:13
@seadowg seadowg merged commit f463746 into getodk:master Jan 17, 2024
6 checks passed
@dbemke
Copy link

dbemke commented Jan 23, 2024

Tested with Success!

Verified on a device with Android 10

Verified cases:

  • the banner is displayed correctly
  • upgrading with a GD project with and without drafts and finalized forms
  • resetting the project after upgrading
  • trying to reconfigure an upgraded GD project with a QR code with an old GD project

@srujner
Copy link

srujner commented Jan 23, 2024

Tested with Success!

Verified on a device with Android 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No banner about GD project after upgrading to the current version
4 participants