Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Add gamification module with streak, XP, badges and offline sync #439
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
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
feat: Add gamification module with streak, XP, badges and offline sync #439
Changes from all commits
d377c5ac68ddd644dfe9543fe0f7File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Check warning on line 321 in app/src/main/java/org/piramalswasthya/sakhi/database/room/InAppDb.kt
Rename this local variable to match the regular expression ^`?[_a-z][a-zA-Z0-9]*`?$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 919
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 402
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
# Check full entity definitions to understand index usage pattern cat -n app/src/main/java/org/piramalswasthya/sakhi/model/GamificationBadge.ktRepository: PSMRI/FLW-Mobile-App
Length of output: 2082
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 3197
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 91
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 5164
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 229
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 1244
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 321
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 46
🏁 Script executed:
Repository: PSMRI/FLW-Mobile-App
Length of output: 459
🌐 Web query:
Room Android Index naming convention unnamed indices schema validation 2.6.1💡 Result:
In Room,
@Indexname handling and schema validation behave as follows (Room 2.x, including 2.6.1): 1) “Unnamed index” naming convention - In@androidx.room.Index, the name property defaults to empty string. If name is not set, Room generates an index name based on the table name and indexed column list: it “will set it to the list of columns joined by ‘’ and prefixed by ‘index${tableName}’”. Example given: table Foo with columns {bar, baz} becomes index_Foo_bar_baz. [1] - Recommendation: if you need to reference the index in a query, don’t rely on the generated name; explicitly set name. [1] 2) How this relates to “unnamed indices schema validation” - Room’s schema JSON (used for schema validation during migrations) includes index information, but Room’s automatic migration schema validator is primarily about validating the table structure. An issue discussion notes that Room does not validate “whether indices are being created correctly” in that context. [2] - Practically, even if your index “name” was auto-generated (because you left@Index.nameunset), the existence/definition of the index in the generated schema is still derived from the@Index/@entity indices metadata. The critical point for schema validation is that Room’s migration validator may not fully verify index creation details across migrations in some test/migration scenarios. [2] 3) Where Room 2.6.1 fits - Room 2.6.1 release notes mainly cover Gradle plugin/schema output behavior (schemaDirectory requirement, flavored schema output paths, committing schemas for validation/auto-migrations) and a validation-related fix around defaultValue parentheses. [3] - The index naming convention itself is defined by the@Indexdocumentation and applies to the annotation behavior. [1] If you share your exact failing validation error (or whether you’re using the Room Gradle Plugin + schemaDirectory, and whether the missing item is the index name vs the index’s existence), I can pinpoint whether the issue is likely “auto-generated index name mismatch” or “index creation not validated by the migration validator”.Citations:
Add explicit index names to match migration instead of relying on unnamed indices.
The entities declare unnamed indices (
indices = [Index(value = ["userId"])]), which Room would auto-name asindex_GAMIFICATION_BADGE_userIdandindex_GAMIFICATION_POINTS_TX_userId. However, the migration creates custom-named indices (idx_gamification_badge_userIdandidx_gamification_tx_userId). This mismatch between the entity schema and migration could cause inconsistencies if auto-migrations or schema validation tools are introduced later.The codebase pattern (e.g.,
DeliveryOutcome,TBSuspected,ReferalCache) explicitly names all indices. Align these two entities with that convention by adding explicitnameparameters:🛠️ Suggested fix
For PointsTransaction.kt:
🤖 Prompt for AI Agents
Uh oh!
There was an error while loading. Please reload this page.