@quesmed/types 2.6.212 → 2.6.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/models/Marksheet.d.ts +9 -1
- package/dist/cjs/resolvers/fragments/marksheet.d.ts +1 -0
- package/dist/cjs/resolvers/fragments/marksheet.js +7 -1
- package/dist/cjs/resolvers/mutation/restricted/marksheet.js +3 -0
- package/dist/cjs/resolvers/mutation/restricted/mockTest.d.ts +2 -1
- package/dist/cjs/resolvers/mutation/restricted/todo.d.ts +5 -1
- package/dist/cjs/resolvers/mutation/restricted/todo.js +45 -3
- package/dist/cjs/resolvers/query/restricted/marksheet.d.ts +2 -3
- package/dist/cjs/resolvers/query/restricted/marksheet.js +6 -3
- package/dist/cjs/resolvers/query/restricted/user.js +2 -28
- package/dist/cjs/utils/evaluateMark.js +6 -1
- package/dist/mjs/models/Marksheet.d.ts +9 -1
- package/dist/mjs/resolvers/fragments/marksheet.d.ts +1 -0
- package/dist/mjs/resolvers/fragments/marksheet.js +6 -0
- package/dist/mjs/resolvers/mutation/restricted/marksheet.js +3 -0
- package/dist/mjs/resolvers/mutation/restricted/mockTest.d.ts +2 -1
- package/dist/mjs/resolvers/mutation/restricted/todo.d.ts +5 -1
- package/dist/mjs/resolvers/mutation/restricted/todo.js +46 -4
- package/dist/mjs/resolvers/query/restricted/marksheet.d.ts +2 -3
- package/dist/mjs/resolvers/query/restricted/marksheet.js +6 -3
- package/dist/mjs/resolvers/query/restricted/user.js +2 -28
- package/dist/mjs/utils/evaluateMark.js +6 -1
- package/package.json +1 -1
|
@@ -86,6 +86,10 @@ export interface IMarksheet {
|
|
|
86
86
|
users: IUser[];
|
|
87
87
|
activeUsers?: IUser[];
|
|
88
88
|
state: EMarksheetState;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Use !!endedAt instead
|
|
91
|
+
* And for timed tests, check if (parent.endedAt && new Date(parent.endedAt) <= new Date());
|
|
92
|
+
*/
|
|
89
93
|
completed: boolean;
|
|
90
94
|
timeTaken: number;
|
|
91
95
|
currentMarkId?: number;
|
|
@@ -114,10 +118,14 @@ export interface IMarksheetMark {
|
|
|
114
118
|
question: IQuestion;
|
|
115
119
|
mark: IMarksheetMarkJSONB;
|
|
116
120
|
marksheet?: IMarksheet;
|
|
117
|
-
isAnswered: boolean;
|
|
118
121
|
striked: number[];
|
|
119
122
|
score: number;
|
|
120
123
|
result: EMarkResult;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use !!mark instead
|
|
126
|
+
*/
|
|
127
|
+
isAnswered: boolean;
|
|
128
|
+
isInDailyStack: boolean;
|
|
121
129
|
}
|
|
122
130
|
export interface IPreBuildMarksheetRef {
|
|
123
131
|
createdAt: number | Date;
|
|
@@ -13,3 +13,4 @@ export declare const MODIFY_CURRENT_MARK_FRAGMENT: import("@apollo/client").Docu
|
|
|
13
13
|
export declare const MARK_FLAGGED_FIELD: import("@apollo/client").DocumentNode;
|
|
14
14
|
export declare const MODIFY_MARKSHEET_COMPLETED_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
15
15
|
export declare const NEW_MARK_FIELDS: import("@apollo/client").DocumentNode;
|
|
16
|
+
export declare const DAILY_STACK_FIELDS: import("@apollo/client").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NEW_MARK_FIELDS = exports.MODIFY_MARKSHEET_COMPLETED_FRAGMENT = exports.MARK_FLAGGED_FIELD = exports.MODIFY_CURRENT_MARK_FRAGMENT = exports.MODIFY_TOPIC_SELECTION_FRAGMENT = exports.MODIFY_MARKSHEET_STATE_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_STRIKED_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID_FRAGMENT = exports.MODIFY_CURRENT_MARKSHEET_MARK_FRAGMENT = exports.MARKSHEET_FIELDS = exports.BUILDER_CONFIG_FIELDS = exports.MARKSHEET_MARK_FIELDS = void 0;
|
|
3
|
+
exports.DAILY_STACK_FIELDS = exports.NEW_MARK_FIELDS = exports.MODIFY_MARKSHEET_COMPLETED_FRAGMENT = exports.MARK_FLAGGED_FIELD = exports.MODIFY_CURRENT_MARK_FRAGMENT = exports.MODIFY_TOPIC_SELECTION_FRAGMENT = exports.MODIFY_MARKSHEET_STATE_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_STRIKED_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID_FRAGMENT = exports.MODIFY_CURRENT_MARKSHEET_MARK_FRAGMENT = exports.MARKSHEET_FIELDS = exports.BUILDER_CONFIG_FIELDS = exports.MARKSHEET_MARK_FIELDS = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
6
|
exports.MARKSHEET_MARK_FIELDS = (0, client_1.gql) `
|
|
@@ -12,6 +12,7 @@ exports.MARKSHEET_MARK_FIELDS = (0, client_1.gql) `
|
|
|
12
12
|
questionChoiceId
|
|
13
13
|
marksheetId
|
|
14
14
|
timeTaken
|
|
15
|
+
isInDailyStack
|
|
15
16
|
isAnswered
|
|
16
17
|
striked
|
|
17
18
|
mark
|
|
@@ -150,3 +151,8 @@ exports.NEW_MARK_FIELDS = (0, client_1.gql) `
|
|
|
150
151
|
score
|
|
151
152
|
}
|
|
152
153
|
`;
|
|
154
|
+
exports.DAILY_STACK_FIELDS = (0, client_1.gql) `
|
|
155
|
+
fragment DailyStackField on MarksheetMark {
|
|
156
|
+
isInDailyStack
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
@@ -70,6 +70,7 @@ exports.SAVE_MARKSHEET = (0, client_1.gql) `
|
|
|
70
70
|
state
|
|
71
71
|
marks {
|
|
72
72
|
isAnswered
|
|
73
|
+
isInDailyStack
|
|
73
74
|
result
|
|
74
75
|
score
|
|
75
76
|
id
|
|
@@ -356,6 +357,7 @@ exports.MODIFY_MARKSHEET_MARK = (0, client_1.gql) `
|
|
|
356
357
|
result
|
|
357
358
|
score
|
|
358
359
|
isAnswered
|
|
360
|
+
isInDailyStack
|
|
359
361
|
striked
|
|
360
362
|
}
|
|
361
363
|
}
|
|
@@ -462,6 +464,7 @@ exports.TOGGLE_STRIKE_OPTIONS = (0, client_1.gql) `
|
|
|
462
464
|
id
|
|
463
465
|
index
|
|
464
466
|
isAnswered
|
|
467
|
+
isInDailyStack
|
|
465
468
|
mark
|
|
466
469
|
result
|
|
467
470
|
score
|
|
@@ -27,10 +27,11 @@ export declare const optimisticToggleFlaggedQuestion: (mark: IMarksheetMark, fla
|
|
|
27
27
|
question: import("../../../models").IQuestion;
|
|
28
28
|
mark: import("../../../models").IMarksheetMarkJSONB;
|
|
29
29
|
marksheet?: IMarksheet | undefined;
|
|
30
|
-
isAnswered: boolean;
|
|
31
30
|
striked: number[];
|
|
32
31
|
score: number;
|
|
33
32
|
result: import("../../../models").EMarkResult;
|
|
33
|
+
isAnswered: boolean;
|
|
34
|
+
isInDailyStack: boolean;
|
|
34
35
|
};
|
|
35
36
|
};
|
|
36
37
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { ITodo, Id } from '../../../models';
|
|
2
|
+
import { IMarksheet, ITodo, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
import { IUserCompletedCard } from './../../../models/User';
|
|
@@ -30,20 +30,24 @@ export declare const optimisticSaveTodos: (todo: ITodo, cardIndex: number, todoI
|
|
|
30
30
|
export declare const ADD_TO_DAILY_STACK: import("@apollo/client").DocumentNode;
|
|
31
31
|
export interface IAddToDailyStackVar {
|
|
32
32
|
conceptIds: Id[];
|
|
33
|
+
marksheetId?: Id;
|
|
33
34
|
}
|
|
34
35
|
export type IAddToDailyStackData = RestrictedData<graphqlNormalize & {
|
|
35
36
|
addedUserCompletedCards: (graphqlNormalize & IUserCompletedCard)[];
|
|
36
37
|
dailyFeed: graphqlNormalize & ITodo;
|
|
38
|
+
marks: graphqlNormalize & IMarksheet['marks'];
|
|
37
39
|
}, 'addToDailyStack'>;
|
|
38
40
|
export declare const REMOVE_FROM_DAILY_STACK: import("@apollo/client").DocumentNode;
|
|
39
41
|
export interface IRemoveFromDailyStackVar {
|
|
40
42
|
cardId?: Id;
|
|
41
43
|
todoId?: Id;
|
|
42
44
|
conceptId?: Id;
|
|
45
|
+
marksheetId?: Id;
|
|
43
46
|
}
|
|
44
47
|
export type IRemoveFromDailyStackData = RestrictedData<graphqlNormalize & {
|
|
45
48
|
removedUserCompletedCards: (graphqlNormalize & IUserCompletedCard)[];
|
|
46
49
|
dailyFeed: graphqlNormalize & ITodo;
|
|
50
|
+
marks: graphqlNormalize & IMarksheet['marks'];
|
|
47
51
|
}, 'removeFromDailyStack'>;
|
|
48
52
|
export declare const updateCacheOnRemoveFromDailyStack: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IRemoveFromDailyStackData>, options: ApolloUpdateOptions) => void;
|
|
49
53
|
export declare const updateCacheOnAddToDailyStack: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddToDailyStackData>) => void;
|
|
@@ -117,9 +117,9 @@ const optimisticSaveTodos = (todo, cardIndex, todoInput) => {
|
|
|
117
117
|
exports.optimisticSaveTodos = optimisticSaveTodos;
|
|
118
118
|
exports.ADD_TO_DAILY_STACK = (0, client_1.gql) `
|
|
119
119
|
${fragments_1.PICTURE_FIELDS}
|
|
120
|
-
mutation AddToDailyStack($conceptIds: [Int!]
|
|
120
|
+
mutation AddToDailyStack($conceptIds: [Int!]!, $marksheetId: Int) {
|
|
121
121
|
restricted {
|
|
122
|
-
addToDailyStack(conceptIds: $conceptIds) {
|
|
122
|
+
addToDailyStack(conceptIds: $conceptIds, marksheetId: $marksheetId) {
|
|
123
123
|
addedUserCompletedCards {
|
|
124
124
|
id
|
|
125
125
|
createdAt
|
|
@@ -152,6 +152,10 @@ exports.ADD_TO_DAILY_STACK = (0, client_1.gql) `
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
marks {
|
|
156
|
+
id
|
|
157
|
+
isInDailyStack
|
|
158
|
+
}
|
|
155
159
|
dailyFeed {
|
|
156
160
|
id
|
|
157
161
|
marks {
|
|
@@ -163,12 +167,18 @@ exports.ADD_TO_DAILY_STACK = (0, client_1.gql) `
|
|
|
163
167
|
}
|
|
164
168
|
`;
|
|
165
169
|
exports.REMOVE_FROM_DAILY_STACK = (0, client_1.gql) `
|
|
166
|
-
mutation RemoveFromDailyStack(
|
|
170
|
+
mutation RemoveFromDailyStack(
|
|
171
|
+
$cardId: Int
|
|
172
|
+
$todoId: Int
|
|
173
|
+
$conceptId: Int
|
|
174
|
+
$marksheetId: Int
|
|
175
|
+
) {
|
|
167
176
|
restricted {
|
|
168
177
|
removeFromDailyStack(
|
|
169
178
|
cardId: $cardId
|
|
170
179
|
todoId: $todoId
|
|
171
180
|
conceptId: $conceptId
|
|
181
|
+
marksheetId: $marksheetId
|
|
172
182
|
) {
|
|
173
183
|
removedUserCompletedCards {
|
|
174
184
|
id
|
|
@@ -178,6 +188,10 @@ exports.REMOVE_FROM_DAILY_STACK = (0, client_1.gql) `
|
|
|
178
188
|
name
|
|
179
189
|
}
|
|
180
190
|
}
|
|
191
|
+
marks {
|
|
192
|
+
id
|
|
193
|
+
isInDailyStack
|
|
194
|
+
}
|
|
181
195
|
dailyFeed {
|
|
182
196
|
id
|
|
183
197
|
marks {
|
|
@@ -217,6 +231,20 @@ const updateCacheOnRemoveFromDailyStack = (cache, result, options) => {
|
|
|
217
231
|
},
|
|
218
232
|
});
|
|
219
233
|
}
|
|
234
|
+
if (data.marks?.length) {
|
|
235
|
+
for (const mark of data.marks) {
|
|
236
|
+
cache.writeFragment({
|
|
237
|
+
id: cache.identify({
|
|
238
|
+
id: mark.id,
|
|
239
|
+
__typename: 'MarksheetMark',
|
|
240
|
+
}),
|
|
241
|
+
data: {
|
|
242
|
+
isInDailyStack: mark.isInDailyStack,
|
|
243
|
+
},
|
|
244
|
+
fragment: fragments_1.DAILY_STACK_FIELDS,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
220
248
|
if (todoId) {
|
|
221
249
|
const prevData = cache.readQuery({
|
|
222
250
|
variables: { id: todoId },
|
|
@@ -267,6 +295,20 @@ const updateCacheOnAddToDailyStack = (cache, result) => {
|
|
|
267
295
|
},
|
|
268
296
|
});
|
|
269
297
|
}
|
|
298
|
+
if (data?.marks?.length) {
|
|
299
|
+
for (const mark of data.marks) {
|
|
300
|
+
cache.writeFragment({
|
|
301
|
+
id: cache.identify({
|
|
302
|
+
id: mark.id,
|
|
303
|
+
__typename: 'MarksheetMark',
|
|
304
|
+
}),
|
|
305
|
+
data: {
|
|
306
|
+
isInDailyStack: mark.isInDailyStack,
|
|
307
|
+
},
|
|
308
|
+
fragment: fragments_1.DAILY_STACK_FIELDS,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
}
|
|
270
312
|
};
|
|
271
313
|
exports.updateCacheOnAddToDailyStack = updateCacheOnAddToDailyStack;
|
|
272
314
|
exports.REFRESH_DAILY_TASK = (0, client_1.gql) `
|
|
@@ -8,12 +8,11 @@ export interface IMarksheetVar {
|
|
|
8
8
|
export type IMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'marksheet'>;
|
|
9
9
|
export declare const MARKSHEET: import("@apollo/client").DocumentNode;
|
|
10
10
|
export interface IMarksheetsVar {
|
|
11
|
-
|
|
11
|
+
options: {
|
|
12
12
|
limit: number;
|
|
13
13
|
order?: ESortOrder;
|
|
14
|
-
|
|
14
|
+
lastId?: number;
|
|
15
15
|
solo?: boolean;
|
|
16
|
-
period?: number;
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
export interface IMarksheetsWindowVar {
|
|
@@ -14,14 +14,18 @@ exports.MARKSHEET = (0, client_1.gql) `
|
|
|
14
14
|
}
|
|
15
15
|
`;
|
|
16
16
|
exports.MARKSHEETS = (0, client_1.gql) `
|
|
17
|
-
query Marksheets($
|
|
17
|
+
query Marksheets($options: MarksheetOptions!) {
|
|
18
18
|
restricted {
|
|
19
|
-
marksheets(
|
|
19
|
+
marksheets(options: $options) {
|
|
20
20
|
results {
|
|
21
21
|
id
|
|
22
22
|
source
|
|
23
23
|
endedAt
|
|
24
24
|
topicNames
|
|
25
|
+
entitlement {
|
|
26
|
+
id
|
|
27
|
+
name
|
|
28
|
+
}
|
|
25
29
|
correct
|
|
26
30
|
incorrect
|
|
27
31
|
totalQuestions
|
|
@@ -45,7 +49,6 @@ exports.MARKSHEETS = (0, client_1.gql) `
|
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
total
|
|
48
|
-
score
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.USER_ACTIVITY = exports.USER_STATS = exports.DAILY_FEED = exports.USER_COMPLETED_DATA = exports.REFERRALS = exports.GET_USER_SUBSCRIPTIONS = exports.USER = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
|
-
const fragments_1 = require("../../fragments");
|
|
6
5
|
const user_1 = require("../../fragments/user");
|
|
7
6
|
exports.USER = (0, client_1.gql) `
|
|
8
7
|
${user_1.USER_FIELDS}
|
|
@@ -50,11 +49,10 @@ exports.REFERRALS = (0, client_1.gql) `
|
|
|
50
49
|
}
|
|
51
50
|
`;
|
|
52
51
|
exports.USER_COMPLETED_DATA = (0, client_1.gql) `
|
|
53
|
-
${
|
|
54
|
-
query CompletedQuestionCards {
|
|
52
|
+
query CompletedQuestionCards($marksheetId: Int) {
|
|
55
53
|
restricted {
|
|
56
54
|
user {
|
|
57
|
-
completedCards {
|
|
55
|
+
completedCards(marksheetId: $marksheetId) {
|
|
58
56
|
id
|
|
59
57
|
createdAt
|
|
60
58
|
updatedAt
|
|
@@ -62,31 +60,7 @@ exports.USER_COMPLETED_DATA = (0, client_1.gql) `
|
|
|
62
60
|
id
|
|
63
61
|
name
|
|
64
62
|
}
|
|
65
|
-
lastSeen
|
|
66
|
-
reviewDate
|
|
67
|
-
score
|
|
68
|
-
iteration
|
|
69
|
-
optimalFactor
|
|
70
|
-
cardId
|
|
71
|
-
card {
|
|
72
|
-
id
|
|
73
|
-
conceptId
|
|
74
|
-
concept {
|
|
75
|
-
id
|
|
76
|
-
name
|
|
77
|
-
}
|
|
78
|
-
topic {
|
|
79
|
-
id
|
|
80
|
-
name
|
|
81
|
-
}
|
|
82
|
-
question
|
|
83
|
-
explanation
|
|
84
|
-
pictures {
|
|
85
|
-
...PictureFields
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
63
|
}
|
|
89
|
-
completedCardsCount
|
|
90
64
|
}
|
|
91
65
|
}
|
|
92
66
|
}
|
|
@@ -80,7 +80,12 @@ function evaluateMark({ mark, answer, questionTypeId, psaSectionId, choices, })
|
|
|
80
80
|
const normalizedAttempt = flatAttempt
|
|
81
81
|
? flatAttempt.toLowerCase().replace(/\s/g, '')
|
|
82
82
|
: '';
|
|
83
|
-
|
|
83
|
+
const answerNum = Number.parseFloat(normalizedAnswer);
|
|
84
|
+
const attemptNum = Number.parseFloat(normalizedAttempt);
|
|
85
|
+
const isNumericMatch = !Number.isNaN(answerNum) &&
|
|
86
|
+
!Number.isNaN(attemptNum) &&
|
|
87
|
+
answerNum === attemptNum;
|
|
88
|
+
if (isNumericMatch || normalizedAnswer === normalizedAttempt) {
|
|
84
89
|
// for psa section, we give 2 marks for correct answer
|
|
85
90
|
data.score = psaSectionId ? 2 : 1;
|
|
86
91
|
data.result = models_1.EMarkResult.Correct;
|
|
@@ -86,6 +86,10 @@ export interface IMarksheet {
|
|
|
86
86
|
users: IUser[];
|
|
87
87
|
activeUsers?: IUser[];
|
|
88
88
|
state: EMarksheetState;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Use !!endedAt instead
|
|
91
|
+
* And for timed tests, check if (parent.endedAt && new Date(parent.endedAt) <= new Date());
|
|
92
|
+
*/
|
|
89
93
|
completed: boolean;
|
|
90
94
|
timeTaken: number;
|
|
91
95
|
currentMarkId?: number;
|
|
@@ -114,10 +118,14 @@ export interface IMarksheetMark {
|
|
|
114
118
|
question: IQuestion;
|
|
115
119
|
mark: IMarksheetMarkJSONB;
|
|
116
120
|
marksheet?: IMarksheet;
|
|
117
|
-
isAnswered: boolean;
|
|
118
121
|
striked: number[];
|
|
119
122
|
score: number;
|
|
120
123
|
result: EMarkResult;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use !!mark instead
|
|
126
|
+
*/
|
|
127
|
+
isAnswered: boolean;
|
|
128
|
+
isInDailyStack: boolean;
|
|
121
129
|
}
|
|
122
130
|
export interface IPreBuildMarksheetRef {
|
|
123
131
|
createdAt: number | Date;
|
|
@@ -13,3 +13,4 @@ export declare const MODIFY_CURRENT_MARK_FRAGMENT: import("@apollo/client").Docu
|
|
|
13
13
|
export declare const MARK_FLAGGED_FIELD: import("@apollo/client").DocumentNode;
|
|
14
14
|
export declare const MODIFY_MARKSHEET_COMPLETED_FRAGMENT: import("@apollo/client").DocumentNode;
|
|
15
15
|
export declare const NEW_MARK_FIELDS: import("@apollo/client").DocumentNode;
|
|
16
|
+
export declare const DAILY_STACK_FIELDS: import("@apollo/client").DocumentNode;
|
|
@@ -9,6 +9,7 @@ export const MARKSHEET_MARK_FIELDS = gql `
|
|
|
9
9
|
questionChoiceId
|
|
10
10
|
marksheetId
|
|
11
11
|
timeTaken
|
|
12
|
+
isInDailyStack
|
|
12
13
|
isAnswered
|
|
13
14
|
striked
|
|
14
15
|
mark
|
|
@@ -147,3 +148,8 @@ export const NEW_MARK_FIELDS = gql `
|
|
|
147
148
|
score
|
|
148
149
|
}
|
|
149
150
|
`;
|
|
151
|
+
export const DAILY_STACK_FIELDS = gql `
|
|
152
|
+
fragment DailyStackField on MarksheetMark {
|
|
153
|
+
isInDailyStack
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
@@ -67,6 +67,7 @@ export const SAVE_MARKSHEET = gql `
|
|
|
67
67
|
state
|
|
68
68
|
marks {
|
|
69
69
|
isAnswered
|
|
70
|
+
isInDailyStack
|
|
70
71
|
result
|
|
71
72
|
score
|
|
72
73
|
id
|
|
@@ -346,6 +347,7 @@ export const MODIFY_MARKSHEET_MARK = gql `
|
|
|
346
347
|
result
|
|
347
348
|
score
|
|
348
349
|
isAnswered
|
|
350
|
+
isInDailyStack
|
|
349
351
|
striked
|
|
350
352
|
}
|
|
351
353
|
}
|
|
@@ -450,6 +452,7 @@ export const TOGGLE_STRIKE_OPTIONS = gql `
|
|
|
450
452
|
id
|
|
451
453
|
index
|
|
452
454
|
isAnswered
|
|
455
|
+
isInDailyStack
|
|
453
456
|
mark
|
|
454
457
|
result
|
|
455
458
|
score
|
|
@@ -27,10 +27,11 @@ export declare const optimisticToggleFlaggedQuestion: (mark: IMarksheetMark, fla
|
|
|
27
27
|
question: import("../../../models").IQuestion;
|
|
28
28
|
mark: import("../../../models").IMarksheetMarkJSONB;
|
|
29
29
|
marksheet?: IMarksheet | undefined;
|
|
30
|
-
isAnswered: boolean;
|
|
31
30
|
striked: number[];
|
|
32
31
|
score: number;
|
|
33
32
|
result: import("../../../models").EMarkResult;
|
|
33
|
+
isAnswered: boolean;
|
|
34
|
+
isInDailyStack: boolean;
|
|
34
35
|
};
|
|
35
36
|
};
|
|
36
37
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloCache } from '@apollo/client';
|
|
2
|
-
import { ITodo, Id } from '../../../models';
|
|
2
|
+
import { IMarksheet, ITodo, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
5
|
import { IUserCompletedCard } from './../../../models/User';
|
|
@@ -30,20 +30,24 @@ export declare const optimisticSaveTodos: (todo: ITodo, cardIndex: number, todoI
|
|
|
30
30
|
export declare const ADD_TO_DAILY_STACK: import("@apollo/client").DocumentNode;
|
|
31
31
|
export interface IAddToDailyStackVar {
|
|
32
32
|
conceptIds: Id[];
|
|
33
|
+
marksheetId?: Id;
|
|
33
34
|
}
|
|
34
35
|
export type IAddToDailyStackData = RestrictedData<graphqlNormalize & {
|
|
35
36
|
addedUserCompletedCards: (graphqlNormalize & IUserCompletedCard)[];
|
|
36
37
|
dailyFeed: graphqlNormalize & ITodo;
|
|
38
|
+
marks: graphqlNormalize & IMarksheet['marks'];
|
|
37
39
|
}, 'addToDailyStack'>;
|
|
38
40
|
export declare const REMOVE_FROM_DAILY_STACK: import("@apollo/client").DocumentNode;
|
|
39
41
|
export interface IRemoveFromDailyStackVar {
|
|
40
42
|
cardId?: Id;
|
|
41
43
|
todoId?: Id;
|
|
42
44
|
conceptId?: Id;
|
|
45
|
+
marksheetId?: Id;
|
|
43
46
|
}
|
|
44
47
|
export type IRemoveFromDailyStackData = RestrictedData<graphqlNormalize & {
|
|
45
48
|
removedUserCompletedCards: (graphqlNormalize & IUserCompletedCard)[];
|
|
46
49
|
dailyFeed: graphqlNormalize & ITodo;
|
|
50
|
+
marks: graphqlNormalize & IMarksheet['marks'];
|
|
47
51
|
}, 'removeFromDailyStack'>;
|
|
48
52
|
export declare const updateCacheOnRemoveFromDailyStack: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IRemoveFromDailyStackData>, options: ApolloUpdateOptions) => void;
|
|
49
53
|
export declare const updateCacheOnAddToDailyStack: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddToDailyStackData>) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
-
import { PICTURE_FIELDS } from '../../fragments';
|
|
2
|
+
import { DAILY_STACK_FIELDS, PICTURE_FIELDS } from '../../fragments';
|
|
3
3
|
import { TODO, USER_COMPLETED_DATA, } from '../../query/restricted';
|
|
4
4
|
export const BUILD_TODO = gql `
|
|
5
5
|
mutation BuildTodo($buildTodo: BuildTodoInput!) {
|
|
@@ -111,9 +111,9 @@ export const optimisticSaveTodos = (todo, cardIndex, todoInput) => {
|
|
|
111
111
|
};
|
|
112
112
|
export const ADD_TO_DAILY_STACK = gql `
|
|
113
113
|
${PICTURE_FIELDS}
|
|
114
|
-
mutation AddToDailyStack($conceptIds: [Int!]
|
|
114
|
+
mutation AddToDailyStack($conceptIds: [Int!]!, $marksheetId: Int) {
|
|
115
115
|
restricted {
|
|
116
|
-
addToDailyStack(conceptIds: $conceptIds) {
|
|
116
|
+
addToDailyStack(conceptIds: $conceptIds, marksheetId: $marksheetId) {
|
|
117
117
|
addedUserCompletedCards {
|
|
118
118
|
id
|
|
119
119
|
createdAt
|
|
@@ -146,6 +146,10 @@ export const ADD_TO_DAILY_STACK = gql `
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
marks {
|
|
150
|
+
id
|
|
151
|
+
isInDailyStack
|
|
152
|
+
}
|
|
149
153
|
dailyFeed {
|
|
150
154
|
id
|
|
151
155
|
marks {
|
|
@@ -157,12 +161,18 @@ export const ADD_TO_DAILY_STACK = gql `
|
|
|
157
161
|
}
|
|
158
162
|
`;
|
|
159
163
|
export const REMOVE_FROM_DAILY_STACK = gql `
|
|
160
|
-
mutation RemoveFromDailyStack(
|
|
164
|
+
mutation RemoveFromDailyStack(
|
|
165
|
+
$cardId: Int
|
|
166
|
+
$todoId: Int
|
|
167
|
+
$conceptId: Int
|
|
168
|
+
$marksheetId: Int
|
|
169
|
+
) {
|
|
161
170
|
restricted {
|
|
162
171
|
removeFromDailyStack(
|
|
163
172
|
cardId: $cardId
|
|
164
173
|
todoId: $todoId
|
|
165
174
|
conceptId: $conceptId
|
|
175
|
+
marksheetId: $marksheetId
|
|
166
176
|
) {
|
|
167
177
|
removedUserCompletedCards {
|
|
168
178
|
id
|
|
@@ -172,6 +182,10 @@ export const REMOVE_FROM_DAILY_STACK = gql `
|
|
|
172
182
|
name
|
|
173
183
|
}
|
|
174
184
|
}
|
|
185
|
+
marks {
|
|
186
|
+
id
|
|
187
|
+
isInDailyStack
|
|
188
|
+
}
|
|
175
189
|
dailyFeed {
|
|
176
190
|
id
|
|
177
191
|
marks {
|
|
@@ -211,6 +225,20 @@ export const updateCacheOnRemoveFromDailyStack = (cache, result, options) => {
|
|
|
211
225
|
},
|
|
212
226
|
});
|
|
213
227
|
}
|
|
228
|
+
if (data.marks?.length) {
|
|
229
|
+
for (const mark of data.marks) {
|
|
230
|
+
cache.writeFragment({
|
|
231
|
+
id: cache.identify({
|
|
232
|
+
id: mark.id,
|
|
233
|
+
__typename: 'MarksheetMark',
|
|
234
|
+
}),
|
|
235
|
+
data: {
|
|
236
|
+
isInDailyStack: mark.isInDailyStack,
|
|
237
|
+
},
|
|
238
|
+
fragment: DAILY_STACK_FIELDS,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
214
242
|
if (todoId) {
|
|
215
243
|
const prevData = cache.readQuery({
|
|
216
244
|
variables: { id: todoId },
|
|
@@ -260,6 +288,20 @@ export const updateCacheOnAddToDailyStack = (cache, result) => {
|
|
|
260
288
|
},
|
|
261
289
|
});
|
|
262
290
|
}
|
|
291
|
+
if (data?.marks?.length) {
|
|
292
|
+
for (const mark of data.marks) {
|
|
293
|
+
cache.writeFragment({
|
|
294
|
+
id: cache.identify({
|
|
295
|
+
id: mark.id,
|
|
296
|
+
__typename: 'MarksheetMark',
|
|
297
|
+
}),
|
|
298
|
+
data: {
|
|
299
|
+
isInDailyStack: mark.isInDailyStack,
|
|
300
|
+
},
|
|
301
|
+
fragment: DAILY_STACK_FIELDS,
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
263
305
|
};
|
|
264
306
|
export const REFRESH_DAILY_TASK = gql `
|
|
265
307
|
${PICTURE_FIELDS}
|
|
@@ -8,12 +8,11 @@ export interface IMarksheetVar {
|
|
|
8
8
|
export type IMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'marksheet'>;
|
|
9
9
|
export declare const MARKSHEET: import("@apollo/client").DocumentNode;
|
|
10
10
|
export interface IMarksheetsVar {
|
|
11
|
-
|
|
11
|
+
options: {
|
|
12
12
|
limit: number;
|
|
13
13
|
order?: ESortOrder;
|
|
14
|
-
|
|
14
|
+
lastId?: number;
|
|
15
15
|
solo?: boolean;
|
|
16
|
-
period?: number;
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
export interface IMarksheetsWindowVar {
|
|
@@ -11,14 +11,18 @@ export const MARKSHEET = gql `
|
|
|
11
11
|
}
|
|
12
12
|
`;
|
|
13
13
|
export const MARKSHEETS = gql `
|
|
14
|
-
query Marksheets($
|
|
14
|
+
query Marksheets($options: MarksheetOptions!) {
|
|
15
15
|
restricted {
|
|
16
|
-
marksheets(
|
|
16
|
+
marksheets(options: $options) {
|
|
17
17
|
results {
|
|
18
18
|
id
|
|
19
19
|
source
|
|
20
20
|
endedAt
|
|
21
21
|
topicNames
|
|
22
|
+
entitlement {
|
|
23
|
+
id
|
|
24
|
+
name
|
|
25
|
+
}
|
|
22
26
|
correct
|
|
23
27
|
incorrect
|
|
24
28
|
totalQuestions
|
|
@@ -42,7 +46,6 @@ export const MARKSHEETS = gql `
|
|
|
42
46
|
}
|
|
43
47
|
}
|
|
44
48
|
total
|
|
45
|
-
score
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
-
import { PICTURE_FIELDS } from '../../fragments';
|
|
3
2
|
import { USER_FIELDS } from '../../fragments/user';
|
|
4
3
|
export const USER = gql `
|
|
5
4
|
${USER_FIELDS}
|
|
@@ -47,11 +46,10 @@ export const REFERRALS = gql `
|
|
|
47
46
|
}
|
|
48
47
|
`;
|
|
49
48
|
export const USER_COMPLETED_DATA = gql `
|
|
50
|
-
${
|
|
51
|
-
query CompletedQuestionCards {
|
|
49
|
+
query CompletedQuestionCards($marksheetId: Int) {
|
|
52
50
|
restricted {
|
|
53
51
|
user {
|
|
54
|
-
completedCards {
|
|
52
|
+
completedCards(marksheetId: $marksheetId) {
|
|
55
53
|
id
|
|
56
54
|
createdAt
|
|
57
55
|
updatedAt
|
|
@@ -59,31 +57,7 @@ export const USER_COMPLETED_DATA = gql `
|
|
|
59
57
|
id
|
|
60
58
|
name
|
|
61
59
|
}
|
|
62
|
-
lastSeen
|
|
63
|
-
reviewDate
|
|
64
|
-
score
|
|
65
|
-
iteration
|
|
66
|
-
optimalFactor
|
|
67
|
-
cardId
|
|
68
|
-
card {
|
|
69
|
-
id
|
|
70
|
-
conceptId
|
|
71
|
-
concept {
|
|
72
|
-
id
|
|
73
|
-
name
|
|
74
|
-
}
|
|
75
|
-
topic {
|
|
76
|
-
id
|
|
77
|
-
name
|
|
78
|
-
}
|
|
79
|
-
question
|
|
80
|
-
explanation
|
|
81
|
-
pictures {
|
|
82
|
-
...PictureFields
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
60
|
}
|
|
86
|
-
completedCardsCount
|
|
87
61
|
}
|
|
88
62
|
}
|
|
89
63
|
}
|
|
@@ -77,7 +77,12 @@ export function evaluateMark({ mark, answer, questionTypeId, psaSectionId, choic
|
|
|
77
77
|
const normalizedAttempt = flatAttempt
|
|
78
78
|
? flatAttempt.toLowerCase().replace(/\s/g, '')
|
|
79
79
|
: '';
|
|
80
|
-
|
|
80
|
+
const answerNum = Number.parseFloat(normalizedAnswer);
|
|
81
|
+
const attemptNum = Number.parseFloat(normalizedAttempt);
|
|
82
|
+
const isNumericMatch = !Number.isNaN(answerNum) &&
|
|
83
|
+
!Number.isNaN(attemptNum) &&
|
|
84
|
+
answerNum === attemptNum;
|
|
85
|
+
if (isNumericMatch || normalizedAnswer === normalizedAttempt) {
|
|
81
86
|
// for psa section, we give 2 marks for correct answer
|
|
82
87
|
data.score = psaSectionId ? 2 : 1;
|
|
83
88
|
data.result = EMarkResult.Correct;
|