CS342 / 2024-Prisma

MIT License
2 stars 1 forks source link

Create a Timestamp for New Account Creation #24

Closed mjoerke closed 7 months ago

mjoerke commented 7 months ago

Timestamp for New Account Creation

:recycle: Current situation & Problem

We are transitioning the backend from a fixed, 15min featurization schedule to a Firestore listener-based schedule (see this PR for progress). As part of this migration, we have set up a listener on the studies/STUDY_ID/users collection to monitor new users. This listener is not triggered by changes to the users collection, as this would trigger on every single data upload to any user. Instead, I propose adding a created_at timestamp to each user document, and having the listener trigger on the query: new_user_query = users_ref.where(filter=FieldFilter('created_at', '>', self.last_query_time)).

However, this field is not automatically created for new users. This PR adds functionality to the iOS app to set the field appropriately upon account creation.

:gear: Release Notes

:books: Documentation

Please ensure that you properly document any additions in conformance to Spezi Documentation Guide. You can use this section to describe your solution, but we encourage contributors to document your reasoning and changes using in-line documentation.

:white_check_mark: Testing

Please ensure that the PR meets the testing requirements set by CodeCov and that new functionality is appropriately tested. This section describes important information about the tests and why some elements might not be testable.

:pencil: Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

codecov[bot] commented 7 months ago

Codecov Report

Attention: 76 lines in your changes are missing coverage. Please review.

Comparison is base (b665da2) 37.67% compared to head (eb54dca) 35.78%. Report is 1 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24/graphs/tree.svg?width=650&height=150&src=pr&token=Kl2PgPHuci&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342)](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342) ```diff @@ Coverage Diff @@ ## main #24 +/- ## ========================================== - Coverage 37.67% 35.78% -1.88% ========================================== Files 39 40 +1 Lines 1301 1378 +77 ========================================== + Hits 490 493 +3 - Misses 811 885 +74 ``` | [Files](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342) | Coverage Δ | | |---|---|---| | [Prisma/Onboarding/OnboardingFlow.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL09uYm9hcmRpbmcvT25ib2FyZGluZ0Zsb3cuc3dpZnQ=) | `96.43% <100.00%> (-0.44%)` | :arrow_down: | | [Prisma/Standard/PrismaModule.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL1N0YW5kYXJkL1ByaXNtYU1vZHVsZS5zd2lmdA==) | `0.00% <ø> (ø)` | | | [Prisma/Onboarding/AccountOnboarding.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL09uYm9hcmRpbmcvQWNjb3VudE9uYm9hcmRpbmcuc3dpZnQ=) | `0.00% <0.00%> (ø)` | | | [Prisma/Onboarding/NotificationPermissions.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL09uYm9hcmRpbmcvTm90aWZpY2F0aW9uUGVybWlzc2lvbnMuc3dpZnQ=) | `4.35% <50.00%> (+2.13%)` | :arrow_up: | | [Prisma/PrismaDelegate.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL1ByaXNtYURlbGVnYXRlLnN3aWZ0) | `91.79% <50.00%> (-3.87%)` | :arrow_down: | | [Prisma/PushNotifications/PushNotifications.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL1B1c2hOb3RpZmljYXRpb25zL1B1c2hOb3RpZmljYXRpb25zLnN3aWZ0) | `13.16% <13.16%> (ø)` | | | [Prisma/Standard/PrismaStandard.swift](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342#diff-UHJpc21hL1N0YW5kYXJkL1ByaXNtYVN0YW5kYXJkLnN3aWZ0) | `3.90% <0.00%> (-1.23%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342). Last update [b97b5a3...eb54dca](https://app.codecov.io/gh/CS342/2024-Prisma/pull/24?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CS342).