@quesmed/types-rn 2.6.218 → 2.6.220
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/models/Job.d.ts +15 -11
- package/models/Job.js +1 -0
- package/models/Psa.d.ts +1 -0
- package/models/Question.d.ts +1 -0
- package/package.json +1 -1
- package/resolvers/mutation/restricted/marksheet.js +22 -3
- package/utils/evaluateMark.d.ts +5 -1
- package/utils/evaluateMark.js +22 -22
package/models/Job.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Id } from '../models';
|
|
1
|
+
import { IChapter, IOsceStation, IQuestionPrescription, Id } from '../models';
|
|
2
2
|
import { EMockTestType } from './MockTest';
|
|
3
3
|
import { IPicture } from './Picture';
|
|
4
4
|
import { EEntitlementType, EProductType } from './Product';
|
|
5
|
-
import { EQuestionType, IQuestionAnswer, IQuestionChoice, IQuestionComment } from './Question';
|
|
5
|
+
import { EQuestionType, IQuestion, IQuestionAnswer, IQuestionCase, IQuestionChoice, IQuestionComment } from './Question';
|
|
6
6
|
import { IUser } from './User';
|
|
7
7
|
export declare enum EJobPriority {
|
|
8
8
|
LOW = 1,
|
|
@@ -62,7 +62,8 @@ export declare enum ELightGalleryType {
|
|
|
62
62
|
EXAMINER = 6,
|
|
63
63
|
CANDIDATE = 7,
|
|
64
64
|
WALKTHROUGH = 8,
|
|
65
|
-
ACTOR = 9
|
|
65
|
+
ACTOR = 9,
|
|
66
|
+
CHOICE_EXPLANATION = 10
|
|
66
67
|
}
|
|
67
68
|
export declare enum EJobRemarkStatus {
|
|
68
69
|
ALL = 0,
|
|
@@ -130,6 +131,10 @@ export interface IJobRecordQuestion {
|
|
|
130
131
|
choices: Array<Pick<IQuestionChoice, 'label' | 'name' | 'answer'> & {
|
|
131
132
|
explanation?: IQuestionChoice['explanation'];
|
|
132
133
|
}>;
|
|
134
|
+
prescriptions?: Array<Omit<IQuestionPrescription, 'id'>>;
|
|
135
|
+
cases?: Array<Pick<IQuestionCase, 'label' | 'case'> & {
|
|
136
|
+
explanation?: IQuestionCase['explanation'];
|
|
137
|
+
}>;
|
|
133
138
|
irtParameters?: IRTParameters | null;
|
|
134
139
|
}
|
|
135
140
|
export interface IJobRecordChapter {
|
|
@@ -157,6 +162,10 @@ export interface IJobRecordMockTest {
|
|
|
157
162
|
choices: Array<Pick<IQuestionChoice, 'label' | 'name' | 'answer'> & {
|
|
158
163
|
explanation?: IQuestionChoice['explanation'];
|
|
159
164
|
}>;
|
|
165
|
+
prescriptions?: Array<Omit<IQuestionPrescription, 'id'>>;
|
|
166
|
+
cases?: Array<Pick<IQuestionCase, 'label' | 'case'> & {
|
|
167
|
+
explanation?: IQuestionCase['explanation'];
|
|
168
|
+
}>;
|
|
160
169
|
irtParameters?: IRTParameters | null;
|
|
161
170
|
}
|
|
162
171
|
export interface IJobRecordMetricsSummary {
|
|
@@ -171,12 +180,6 @@ export interface IJobRecordMetricsSummary {
|
|
|
171
180
|
dislikes: number;
|
|
172
181
|
public: boolean;
|
|
173
182
|
}
|
|
174
|
-
export interface IJobRecordChoiceVote {
|
|
175
|
-
id: Id;
|
|
176
|
-
label: string;
|
|
177
|
-
votes: number;
|
|
178
|
-
percentage: number;
|
|
179
|
-
}
|
|
180
183
|
export interface IJobRecordChoiceSummary {
|
|
181
184
|
id: Id;
|
|
182
185
|
label: string;
|
|
@@ -197,12 +200,13 @@ export interface IJobRecord {
|
|
|
197
200
|
createdBy: IUser['id'];
|
|
198
201
|
createdByUser: Pick<IUser, 'id' | 'firstName' | 'lastName' | 'username' | 'accessLevel'>;
|
|
199
202
|
questionId: number | null;
|
|
203
|
+
question?: IQuestion;
|
|
200
204
|
stationId: number | null;
|
|
205
|
+
station?: IOsceStation;
|
|
201
206
|
chapterId: number | null;
|
|
207
|
+
chapter?: IChapter;
|
|
202
208
|
remarks: IJobRemark[];
|
|
203
209
|
assets: IJobAsset[];
|
|
204
|
-
metricsSummary: IJobRecordMetricsSummary | null;
|
|
205
|
-
choiceSummary: IJobRecordChoiceSummary[] | null;
|
|
206
210
|
referenceCount: number;
|
|
207
211
|
}
|
|
208
212
|
export interface IJobMetaData {
|
package/models/Job.js
CHANGED
|
@@ -91,6 +91,7 @@ var ELightGalleryType;
|
|
|
91
91
|
ELightGalleryType[ELightGalleryType["CANDIDATE"] = 7] = "CANDIDATE";
|
|
92
92
|
ELightGalleryType[ELightGalleryType["WALKTHROUGH"] = 8] = "WALKTHROUGH";
|
|
93
93
|
ELightGalleryType[ELightGalleryType["ACTOR"] = 9] = "ACTOR";
|
|
94
|
+
ELightGalleryType[ELightGalleryType["CHOICE_EXPLANATION"] = 10] = "CHOICE_EXPLANATION";
|
|
94
95
|
})(ELightGalleryType = exports.ELightGalleryType || (exports.ELightGalleryType = {}));
|
|
95
96
|
var EJobRemarkStatus;
|
|
96
97
|
(function (EJobRemarkStatus) {
|
package/models/Psa.d.ts
CHANGED
package/models/Question.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TOGGLE_STRIKE_OPTIONS = exports.optimisticEndMarksheet = exports.updateCacheOnEndMarksheet = exports.END_MARKSHEET = exports.LEAVE_MARKSHEET = exports.MODIFY_CURRENT_MARKSHEET_MARK = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID = exports.MODIFY_MARKSHEET_MARK_STRIKED = exports.MODIFY_MARKSHEET_MARK = exports.MODIFY_MARKSHEET_STATE = exports.MODIFY_TOPIC_SELECTION = exports.MODIFY_BUILDER_CONFIG = exports.MODIFY_MARKSHEET = exports.optimisticModifyMarksheetBuilderConfig = exports.START_OR_JOIN_MARKSHEET = exports.optimisticRemoveFlaggedQuestion = exports.updateCacheRemoveFlaggedQuestion = exports.optimisticAddFlaggedQuestion = exports.updateCacheAddFlaggedQuestion = exports.REMOVE_FLAGGED_QUESTION = exports.ADD_FLAGGED_QUESTION = exports.optimisticSaveMarksheets = exports.updateMarksheets = exports.SAVE_MARKSHEET = exports.QUICK_BUILD_MARKSHEET = exports.RE_BUILD_MARKSHEET = exports.BUILD_UCAT_MARKSHEET = exports.BUILD_MARKSHEET = exports.BUILD_QUESTION_MARKSHEET = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
5
6
|
const marksheet_1 = require("../../fragments/marksheet");
|
|
6
7
|
const restricted_1 = require("../../query/restricted");
|
|
7
8
|
exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
|
|
@@ -119,8 +120,26 @@ const updateMarksheets = (cache, result, options) => {
|
|
|
119
120
|
};
|
|
120
121
|
exports.updateMarksheets = updateMarksheets;
|
|
121
122
|
const optimisticSaveMarksheets = (marksheet, marksheetInput, questionIndex) => {
|
|
122
|
-
const { timeTaken, choiceId, mark, marksheetId } = marksheetInput;
|
|
123
|
+
const { timeTaken, choiceId, mark, marksheetId, markId } = marksheetInput;
|
|
123
124
|
const { marks = [], ...rest } = marksheet || {};
|
|
125
|
+
const currentMark = marks.find((m) => Number(m.id) === Number(markId));
|
|
126
|
+
if (!currentMark) {
|
|
127
|
+
return {
|
|
128
|
+
restricted: {
|
|
129
|
+
saveMarksheets: [{ ...rest, marks }],
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const { psaSectionId, choices, typeId } = currentMark.question;
|
|
134
|
+
const { answerField } = (0, utils_1.getQuestionInfo)(typeId, psaSectionId);
|
|
135
|
+
const answer = currentMark.question[answerField];
|
|
136
|
+
const { result, score } = (0, utils_1.evaluateMark)({
|
|
137
|
+
mark: mark || '',
|
|
138
|
+
answer,
|
|
139
|
+
psaSectionId,
|
|
140
|
+
questionTypeId: typeId,
|
|
141
|
+
choices,
|
|
142
|
+
});
|
|
124
143
|
const updatedMark = {
|
|
125
144
|
...marks[questionIndex],
|
|
126
145
|
marksheetId,
|
|
@@ -128,8 +147,8 @@ const optimisticSaveMarksheets = (marksheet, marksheetInput, questionIndex) => {
|
|
|
128
147
|
questionChoiceId: choiceId ?? null,
|
|
129
148
|
isAnswered: true,
|
|
130
149
|
mark: mark || null,
|
|
131
|
-
result
|
|
132
|
-
score
|
|
150
|
+
result,
|
|
151
|
+
score,
|
|
133
152
|
};
|
|
134
153
|
const updatedMarks = [
|
|
135
154
|
...marks.slice(0, questionIndex),
|
package/utils/evaluateMark.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ export interface IEvaluateMarkData {
|
|
|
4
4
|
result: EMarkResult;
|
|
5
5
|
maxScore: number;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type IQuestionInfo = {
|
|
8
|
+
maxScore: number;
|
|
9
|
+
answerField: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getQuestionInfo(questionType: EQuestionType, psaSectionId: number | null): IQuestionInfo;
|
|
8
12
|
export declare function evaluateMark({ mark, answer, questionTypeId, psaSectionId, choices, }: {
|
|
9
13
|
mark: IMarksheetMarkJSONB;
|
|
10
14
|
answer: IQuestionAnswer;
|
package/utils/evaluateMark.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.evaluateMark = exports.
|
|
3
|
+
exports.evaluateMark = exports.getQuestionInfo = void 0;
|
|
4
4
|
const models_1 = require("../models");
|
|
5
5
|
function isPrescribeAnswer(data) {
|
|
6
6
|
return Object(data).hasOwnProperty('dose');
|
|
@@ -44,51 +44,51 @@ function deepParse(data) {
|
|
|
44
44
|
}
|
|
45
45
|
return parsed;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function getQuestionInfo(questionType, psaSectionId) {
|
|
48
48
|
switch (questionType) {
|
|
49
49
|
case models_1.EQuestionType.SINGLE_BEST_ANSWER:
|
|
50
50
|
if (psaSectionId) {
|
|
51
|
-
return 2;
|
|
51
|
+
return { maxScore: 2, answerField: 'sbaAnswer' };
|
|
52
52
|
}
|
|
53
|
-
return 1;
|
|
53
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
54
54
|
case models_1.EQuestionType.QUESTION_ANSWER:
|
|
55
55
|
if (psaSectionId) {
|
|
56
|
-
return 2;
|
|
56
|
+
return { maxScore: 2, answerField: 'qaAnswer' };
|
|
57
57
|
}
|
|
58
|
-
return 1;
|
|
58
|
+
return { maxScore: 1, answerField: 'qaAnswer' };
|
|
59
59
|
case models_1.EQuestionType.MULTIPLE_ANSWERS:
|
|
60
|
-
return 4;
|
|
60
|
+
return { maxScore: 4, answerField: 'multiAnswer' };
|
|
61
61
|
case models_1.EQuestionType.PRESCRIPTION_ANSWER:
|
|
62
|
-
return 10;
|
|
62
|
+
return { maxScore: 10, answerField: 'prescribeAnswer' };
|
|
63
63
|
case models_1.EQuestionType.EXTENDED_MATCHING_ANSWER:
|
|
64
|
-
return 1;
|
|
64
|
+
return { maxScore: 1, answerField: 'emqAnswer' };
|
|
65
65
|
case models_1.EQuestionType.SELECT_THREE_ANSWER:
|
|
66
|
-
return 1;
|
|
66
|
+
return { maxScore: 1, answerField: 'select3Answer' };
|
|
67
67
|
case models_1.EQuestionType.RANKING_ANSWER:
|
|
68
|
-
return 1;
|
|
68
|
+
return { maxScore: 1, answerField: 'rankingAnswer' };
|
|
69
69
|
case models_1.EQuestionType.SBA_WITH_MULTIPLE_CHOICES:
|
|
70
|
-
return 1;
|
|
70
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
71
71
|
case models_1.EQuestionType.VERBAL_VERACITY:
|
|
72
|
-
return 1;
|
|
72
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
73
73
|
case models_1.EQuestionType.VERBAL_READING_COMPREHENSION:
|
|
74
|
-
return 1;
|
|
74
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
75
75
|
case models_1.EQuestionType.QUANTITATIVE_REASONING_SBA:
|
|
76
|
-
return 1;
|
|
76
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
77
77
|
case models_1.EQuestionType.DECISION_MAKING_SBA:
|
|
78
|
-
return 1;
|
|
78
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
79
79
|
case models_1.EQuestionType.DECISION_MAKING_YES_NO:
|
|
80
|
-
return 2;
|
|
80
|
+
return { maxScore: 2, answerField: 'multiAnswer' };
|
|
81
81
|
case models_1.EQuestionType.SJT_SINGLE_CHOICE:
|
|
82
|
-
return 1;
|
|
82
|
+
return { maxScore: 1, answerField: 'sbaAnswer' };
|
|
83
83
|
case models_1.EQuestionType.SJT_TWO_ANSWERS:
|
|
84
|
-
return 1;
|
|
84
|
+
return { maxScore: 1, answerField: 'rankingAnswer' };
|
|
85
85
|
default:
|
|
86
|
-
return 1;
|
|
86
|
+
return { maxScore: 1, answerField: 'answer' };
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
exports.
|
|
89
|
+
exports.getQuestionInfo = getQuestionInfo;
|
|
90
90
|
function evaluateMark({ mark, answer, questionTypeId, psaSectionId, choices, }) {
|
|
91
|
-
const maxScore =
|
|
91
|
+
const { maxScore } = getQuestionInfo(questionTypeId, psaSectionId);
|
|
92
92
|
const data = {
|
|
93
93
|
score: 0,
|
|
94
94
|
result: models_1.EMarkResult.Incorrect,
|