Convert one exerciseResponses db.scan to pg lookup#2617
Conversation
|
Warning Review limit reached
More reviews will be available in 27 minutes and 32 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR replaces one
Confidence Score: 5/5Safe to merge — the change is a like-for-like translation of a single filter into a direct Postgres query with no behavioral difference. The rewritten query is semantically identical to the old db.scan call. The only edge-case risk (inArray receiving an empty array, which generates invalid SQL) is already prevented by the existing allExercises.length === 0 early-return guard. No other logic in the file is touched. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant areAllFoaiExercisesComplete
participant db_scan as db.scan (Airtable/PG hybrid)
participant db_pg as db.pg (Drizzle/Postgres)
Caller->>areAllFoaiExercisesComplete: email
areAllFoaiExercisesComplete->>db_scan: "scan(exerciseTable, {courseId, status})"
db_scan-->>areAllFoaiExercisesComplete: allExercises[]
alt allExercises is empty
areAllFoaiExercisesComplete-->>Caller: false
else
areAllFoaiExercisesComplete->>db_pg: "SELECT WHERE email=? AND exerciseId IN (?)"
Note over areAllFoaiExercisesComplete,db_pg: Previously: db.scan(exerciseResponseTable, AND/OR filter)
db_pg-->>areAllFoaiExercisesComplete: exerciseResponses[]
areAllFoaiExercisesComplete-->>Caller: allExercises.every(id in completedSet)
end
Reviews (1): Last reviewed commit: "Convert one exerciseResponses db.scan to..." | Re-trigger Greptile |
Description
Parcelling this out to reduce the diff of the PR to flip this table to postgres-only (#2616)
Issue
#2580
Developer checklist