Repository navigation
Conversation
`npm run lint` failed the backend job on these two lines, which stops the build, type-check and test steps before they run.
Author
|
@LabsCrypt both failing checks are green now. Before: Root cause & fix
Head |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
scoreController.tsandsimulationController.tsread and wrote thescorestable through columns that do not exist:SELECT score FROM scores WHERE borrower = $1andINSERT INTO scores (borrower, score) ... ON CONFLICT (borrower). The table created by1771691269865_initial-schema.jsonly hasuser_idandcurrent_score, soGET /api/score/:userId,POST /api/score/update,GET /api/simulation/:userId/historyandPOST /api/simulation/simulate-paymentall failed with a 500 (column "borrower" does not exist).Related Issue
Closes #1801
Changes
[MODIFY]
backend/src/controllers/scoreController.tsgetScore/updateScore:SELECT current_score AS score FROM scores WHERE user_id = $1.updateScoreupsert:INSERT INTO scores (user_id, current_score) ... ON CONFLICT (user_id) DO UPDATE SET current_score = LEAST(850, GREATEST(300, scores.current_score + $3)) ... RETURNING current_score AS score.getScoreBreakdown: thecurrent_score_ctenow selectsCOALESCE(current_score, 500)withWHERE user_id = $1.[MODIFY]
backend/src/controllers/simulationController.tsgetRemittanceHistory/simulatePayment:SELECT current_score AS score FROM scores WHERE user_id = $1.The
scoreandcurrent_scorerow shapes read by the controllers are preserved via theAS scorealias, so response payloads are unchanged.Verification Results
borrowerreplaced withuser_idscorereplaced withcurrent_scorecurrent_score AS scorekeepsrows[0].scoreworking