You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the change in the user flow of the app, we want a way to track if a user has completed a session on that day. Further, we now want to keep track of the past two sessions' metrics to be displayed in the app.
Requirements
The new model is as follows. I have listed the changes in parentheses beside the change:
lastSessionsMetrics: { (lastSessionMetrics -> lastSessionsMetrics)
date: Date;
math: {
attempted: boolean; (new)
questionsAttempted: number;
questionsCorrect: number;
finalDifficultyScore: number;
timePerQuestion: number;
};
trivia: {
attempted: boolean; (new)
questionsAttempted: number;
questionsCorrect: number;
timePerQuestion: number;
};
reading: {
attempted: boolean; // should be true even if the user attempts the section but skips without completing (new)
passagesRead: number;
timePerPassage: number;
wordsPerMinute: number;
skipped: boolean; (removed "questionsAnswered" and added this)
};
writing: {
attempted: boolean; // should be true even if the user attempts the section but skips without completing (new)
questionsAnswered: number;
timePerQuestion: number;
skipped: boolean; (new)
};
}[]; (now an array)
Update the IAnalytics type and Analytics model to reflect the above (remove all the parentheses while copying but keep the comment).
Subsequently, go through all the routes and MongoDB action functions that use or modify the analytics record, and make the appropriate changes to include and update these new metrics. Specifically, ensure the usage/modification of lastSessionsMetrics, skipped, and attempted are updated.
Now that lastSessionsMetrics is an array, we want it to keep track of only the last two sessions (the most recent one being at index 0).
The current user flow is that the user can complete a game only once per day. The user need not complete all games in sequence or at the same time. Thus, we should see if lastSessionsMetrics[0].date corresponds to the current day. If not, then move record 0 to record 1 and empty out record 0. You will need to do this check when the user logs in (/api/patient/auth/login), and in the /api/patient/analytics/record-* routes.
Further, delete /api/patient/analytics/record-session-complete. Instead do its job in the /api/patient/analytics/record-* routes if lastSessionsMetrics[0].*.attempted = true (* = all games).
Some specific changes to be made:
In getAggregatedAnalytics function: the return value of lastSession.completed for Reading and Writing should be !res.lastSessionsMetrics[0].reading.skipped and !res.lastSessionsMetrics[0].writing.skipped resp.
In the modifyMath, modifyReading, modifyWriting, and modifyTrivia functions, ensure that the attempted (in all) and skipped (in reading and writing) fields are updated in MongoDB.
The text was updated successfully, but these errors were encountered:
Context
With the change in the user flow of the app, we want a way to track if a user has completed a session on that day. Further, we now want to keep track of the past two sessions' metrics to be displayed in the app.
Requirements
The new model is as follows. I have listed the changes in parentheses beside the change:
Update the
IAnalytics
type andAnalytics
model to reflect the above (remove all the parentheses while copying but keep the comment).Subsequently, go through all the routes and MongoDB action functions that use or modify the analytics record, and make the appropriate changes to include and update these new metrics. Specifically, ensure the usage/modification of
lastSessionsMetrics
,skipped
, andattempted
are updated.Now that
lastSessionsMetrics
is an array, we want it to keep track of only the last two sessions (the most recent one being at index 0).The current user flow is that the user can complete a game only once per day. The user need not complete all games in sequence or at the same time. Thus, we should see if
lastSessionsMetrics[0].date
corresponds to the current day. If not, then move record 0 to record 1 and empty out record 0. You will need to do this check when the user logs in (/api/patient/auth/login
), and in the/api/patient/analytics/record-*
routes.Further, delete
/api/patient/analytics/record-session-complete
. Instead do its job in the/api/patient/analytics/record-*
routes iflastSessionsMetrics[0].*.attempted = true
(*
= all games).Some specific changes to be made:
In
getAggregatedAnalytics
function: the return value oflastSession.completed
for Reading and Writing should be!res.lastSessionsMetrics[0].reading.skipped
and!res.lastSessionsMetrics[0].writing.skipped
resp.In
/api/patient/auth/login
, return:modifyMath
,modifyReading
,modifyWriting
, andmodifyTrivia
functions, ensure that theattempted
(in all) andskipped
(in reading and writing) fields are updated in MongoDB.The text was updated successfully, but these errors were encountered: