@quesmed/types 2.5.35 → 2.5.37

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.
@@ -8,6 +8,20 @@ export declare const ERRORS: {
8
8
  SUBSCRIPTION_EXPIRED: string;
9
9
  PERMISSION_INVALID: string;
10
10
  };
11
+ export declare enum EGrammarType {
12
+ QUESTION = 0,
13
+ CARD = 1,
14
+ CONCEPT = 2,
15
+ PSA_MULTI_QA = 3,
16
+ PSA_PRESCRIBE = 4,
17
+ PSA_QA = 5,
18
+ PSA_SBA = 6,
19
+ OSCE = 7,
20
+ BOOK = 8,
21
+ EMQ_QUESTION = 9,
22
+ SJT_QUESTION = 10,
23
+ RA_QUESTION = 11
24
+ }
11
25
  export declare const FCM_TOPICS: {
12
26
  GLOBAL: string;
13
27
  QBANK: string;
package/dist/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.generateDisplayName = exports.medicalWords = exports.termsAndConditions = exports.EPlatformId = exports.FCM_TOPICS = exports.ERRORS = exports.utils = exports.Models = void 0;
29
+ exports.generateDisplayName = exports.medicalWords = exports.termsAndConditions = exports.EPlatformId = exports.FCM_TOPICS = exports.EGrammarType = exports.ERRORS = exports.utils = exports.Models = void 0;
30
30
  const random_1 = require("./utils/random");
31
31
  exports.Models = __importStar(require("./models"));
32
32
  __exportStar(require("./resolvers"), exports);
@@ -38,6 +38,21 @@ exports.ERRORS = {
38
38
  SUBSCRIPTION_EXPIRED: 'Expired subscription.',
39
39
  PERMISSION_INVALID: 'Invalid permission.',
40
40
  };
41
+ var EGrammarType;
42
+ (function (EGrammarType) {
43
+ EGrammarType[EGrammarType["QUESTION"] = 0] = "QUESTION";
44
+ EGrammarType[EGrammarType["CARD"] = 1] = "CARD";
45
+ EGrammarType[EGrammarType["CONCEPT"] = 2] = "CONCEPT";
46
+ EGrammarType[EGrammarType["PSA_MULTI_QA"] = 3] = "PSA_MULTI_QA";
47
+ EGrammarType[EGrammarType["PSA_PRESCRIBE"] = 4] = "PSA_PRESCRIBE";
48
+ EGrammarType[EGrammarType["PSA_QA"] = 5] = "PSA_QA";
49
+ EGrammarType[EGrammarType["PSA_SBA"] = 6] = "PSA_SBA";
50
+ EGrammarType[EGrammarType["OSCE"] = 7] = "OSCE";
51
+ EGrammarType[EGrammarType["BOOK"] = 8] = "BOOK";
52
+ EGrammarType[EGrammarType["EMQ_QUESTION"] = 9] = "EMQ_QUESTION";
53
+ EGrammarType[EGrammarType["SJT_QUESTION"] = 10] = "SJT_QUESTION";
54
+ EGrammarType[EGrammarType["RA_QUESTION"] = 11] = "RA_QUESTION";
55
+ })(EGrammarType = exports.EGrammarType || (exports.EGrammarType = {}));
41
56
  exports.FCM_TOPICS = {
42
57
  GLOBAL: 'global',
43
58
  QBANK: 'qbank',
@@ -18,7 +18,12 @@ export declare enum EQuestionType {
18
18
  SINGLE_BEST_ANSWER = 1,
19
19
  QUESTION_ANSWER = 2,
20
20
  MULTIPLE_ANSWERS = 3,
21
- PRESCRIPTION_ANSWER = 4
21
+ PRESCRIPTION_ANSWER = 4,
22
+ EXTENDED_MATCHING_ANSWER = 5,
23
+ SELECT_THREE_ANSWER = 6,
24
+ RANKING_ANSWER = 7,
25
+ MRCP_PART_1 = 8,
26
+ MRCP_PART_2 = 9
22
27
  }
23
28
  export declare enum EQuestionLike {
24
29
  NONE = 0,
@@ -53,8 +58,8 @@ export interface IQuestionCommentLike {
53
58
  comment: IQuestionComment;
54
59
  likeTrueDislikeFalse: boolean;
55
60
  }
56
- export type IQuestionAnswer = string | [string] | [IQuestionQAAnswer] | [string[], string[]] | IPrescribeAnswer[];
57
- export type IQuestionAll = IQuestion | IQuestionSBA | IQuestionQA | IQuestionMultiQ | IQuestionPrescribe;
61
+ export type IQuestionAnswer = string | [string] | [IQuestionQAAnswer] | [string[], string[]] | IPrescribeAnswer[] | [string, string][] | [string, string, string] | string[];
62
+ export type IQuestionAll = IQuestion | IQuestionSBA | IQuestionQA | IQuestionMultiQ | IQuestionPrescribe | IQuestionEMQ | IQuestionSelect3 | IQuestionRanking;
58
63
  export interface IQuestion {
59
64
  id: Id;
60
65
  createdAt: Date | number;
@@ -70,6 +75,7 @@ export interface IQuestion {
70
75
  answer: IQuestionAnswer;
71
76
  totalVotes: number;
72
77
  choices: IQuestionChoice[];
78
+ cases?: IQuestionCase[];
73
79
  topic?: ITopic;
74
80
  pictures?: IPicture[];
75
81
  difficulty: EDifficultyType;
@@ -111,6 +117,14 @@ export interface IQuestionChoice {
111
117
  votes: number;
112
118
  picture?: IPicture | null;
113
119
  }
120
+ export interface IQuestionCase {
121
+ id: Id;
122
+ updatedAt: number | Date;
123
+ questionId: Id;
124
+ case: string;
125
+ explanation: string;
126
+ label: string;
127
+ }
114
128
  export interface IQuestionElo {
115
129
  id: Id;
116
130
  date: number | Date;
@@ -145,10 +159,25 @@ export interface IQuestionQA extends IQuestion {
145
159
  qaAnswer: [IQuestionQAAnswer];
146
160
  }
147
161
  export declare function isQuestionMultiQ(data: IQuestionAll): data is IQuestionMultiQ;
162
+ export declare function isQuestionEMQ(data: IQuestionAll): data is IQuestionEMQ;
163
+ export declare function isQuestionSelect3(data: IQuestionAll): data is IQuestionSelect3;
164
+ export declare function isQuestionRanking(data: IQuestionAll): data is IQuestionRanking;
148
165
  export interface IQuestionMultiQ extends IQuestion {
149
166
  answer: [string[], string[]];
150
167
  multiAnswer: [string[], string[]];
151
168
  }
169
+ export interface IQuestionEMQ extends IQuestion {
170
+ answer: [string, string][];
171
+ emqAnswer: [string, string][];
172
+ }
173
+ export interface IQuestionSelect3 extends IQuestion {
174
+ answer: [string, string, string];
175
+ answerSelect3: [string, string, string];
176
+ }
177
+ export interface IQuestionRanking extends IQuestion {
178
+ answer: string[];
179
+ answerRanking: string[];
180
+ }
152
181
  export declare function isQuestionPrescribe(data: IQuestionAll): data is IQuestionPrescribe;
153
182
  export interface IQuestionPrescribe extends IQuestion {
154
183
  answer: IPrescribeAnswer[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isQuestionPrescribe = exports.isQuestionMultiQ = exports.isQuestionQA = exports.isQuestionSBA = exports.EQuestionLike = exports.EQuestionType = exports.EPsaSectionType = void 0;
3
+ exports.isQuestionPrescribe = exports.isQuestionRanking = exports.isQuestionSelect3 = exports.isQuestionEMQ = exports.isQuestionMultiQ = exports.isQuestionQA = exports.isQuestionSBA = exports.EQuestionLike = exports.EQuestionType = exports.EPsaSectionType = void 0;
4
4
  var EPsaSectionType;
5
5
  (function (EPsaSectionType) {
6
6
  EPsaSectionType[EPsaSectionType["PRESCRIBING"] = 1] = "PRESCRIBING";
@@ -18,6 +18,11 @@ var EQuestionType;
18
18
  EQuestionType[EQuestionType["QUESTION_ANSWER"] = 2] = "QUESTION_ANSWER";
19
19
  EQuestionType[EQuestionType["MULTIPLE_ANSWERS"] = 3] = "MULTIPLE_ANSWERS";
20
20
  EQuestionType[EQuestionType["PRESCRIPTION_ANSWER"] = 4] = "PRESCRIPTION_ANSWER";
21
+ EQuestionType[EQuestionType["EXTENDED_MATCHING_ANSWER"] = 5] = "EXTENDED_MATCHING_ANSWER";
22
+ EQuestionType[EQuestionType["SELECT_THREE_ANSWER"] = 6] = "SELECT_THREE_ANSWER";
23
+ EQuestionType[EQuestionType["RANKING_ANSWER"] = 7] = "RANKING_ANSWER";
24
+ EQuestionType[EQuestionType["MRCP_PART_1"] = 8] = "MRCP_PART_1";
25
+ EQuestionType[EQuestionType["MRCP_PART_2"] = 9] = "MRCP_PART_2";
21
26
  })(EQuestionType = exports.EQuestionType || (exports.EQuestionType = {}));
22
27
  var EQuestionLike;
23
28
  (function (EQuestionLike) {
@@ -37,6 +42,18 @@ function isQuestionMultiQ(data) {
37
42
  return data.typeId === EQuestionType.MULTIPLE_ANSWERS;
38
43
  }
39
44
  exports.isQuestionMultiQ = isQuestionMultiQ;
45
+ function isQuestionEMQ(data) {
46
+ return data.typeId === EQuestionType.EXTENDED_MATCHING_ANSWER;
47
+ }
48
+ exports.isQuestionEMQ = isQuestionEMQ;
49
+ function isQuestionSelect3(data) {
50
+ return data.typeId === EQuestionType.SELECT_THREE_ANSWER;
51
+ }
52
+ exports.isQuestionSelect3 = isQuestionSelect3;
53
+ function isQuestionRanking(data) {
54
+ return data.typeId === EQuestionType.RANKING_ANSWER;
55
+ }
56
+ exports.isQuestionRanking = isQuestionRanking;
40
57
  function isQuestionPrescribe(data) {
41
58
  return data.typeId === EQuestionType.PRESCRIPTION_ANSWER;
42
59
  }
@@ -47,6 +47,7 @@ exports.VIDEO = (0, client_1.gql) `
47
47
  candidateBrief
48
48
  examinerBrief
49
49
  actorBrief
50
+ explanation
50
51
  marks {
51
52
  id
52
53
  index
@@ -104,6 +104,7 @@ exports.SAMPLE_VIDEO = (0, client_1.gql) `
104
104
  candidateBrief
105
105
  examinerBrief
106
106
  actorBrief
107
+ explanation
107
108
  marks {
108
109
  id
109
110
  index
@@ -140,6 +140,15 @@ function formatPrescribeAnswer(baseAnswer) {
140
140
  return obj;
141
141
  }
142
142
  exports.formatPrescribeAnswer = formatPrescribeAnswer;
143
+ function createHashMap(arr) {
144
+ const map = new Map();
145
+ for (const innerArr of arr) {
146
+ const sortedInnerArr = innerArr.slice().sort();
147
+ const key = sortedInnerArr.join('|');
148
+ map.set(key, (map.get(key) || 0) + 1);
149
+ }
150
+ return map;
151
+ }
143
152
  function correctMark(mark) {
144
153
  const data = {
145
154
  correct: false,
@@ -246,6 +255,65 @@ function correctMark(mark) {
246
255
  data.incorrect = true;
247
256
  }
248
257
  }
258
+ else if (models_1.EQuestionType.EXTENDED_MATCHING_ANSWER === mark.question.typeId) {
259
+ const extendedAnswer = answer;
260
+ const attempt = jsonAnswer;
261
+ if (extendedAnswer.length !== attempt.length) {
262
+ data.incorrect = true;
263
+ }
264
+ else {
265
+ const map1 = createHashMap(extendedAnswer);
266
+ const map2 = createHashMap(attempt);
267
+ for (const [key, value] of map1) {
268
+ if (map2.get(key) !== value) {
269
+ data.incorrect = true;
270
+ break;
271
+ }
272
+ }
273
+ if (!data.incorrect) {
274
+ data.correct = true;
275
+ }
276
+ }
277
+ }
278
+ else if (models_1.EQuestionType.SELECT_THREE_ANSWER === mark.question.typeId) {
279
+ const threeAnswer = answer;
280
+ const attempt = jsonAnswer;
281
+ if (threeAnswer.length !== 3) {
282
+ data.incorrect = true;
283
+ }
284
+ else {
285
+ const answerSet = new Set(threeAnswer);
286
+ for (const attemptLabel of attempt) {
287
+ if (!answerSet.has(attemptLabel)) {
288
+ data.incorrect = true;
289
+ break;
290
+ }
291
+ }
292
+ if (!data.incorrect) {
293
+ data.correct = true;
294
+ }
295
+ }
296
+ }
297
+ else if (models_1.EQuestionType.RANKING_ANSWER === mark.question.typeId) {
298
+ // Duplicate logic to Extended Matching, but they have different scoring systems
299
+ // which we may add at a later point
300
+ const rankAnswer = answer;
301
+ const attempt = jsonAnswer;
302
+ if (rankAnswer.length !== attempt.length) {
303
+ data.incorrect = true;
304
+ }
305
+ else {
306
+ for (let i = 0; i < rankAnswer.length; i++) {
307
+ if (rankAnswer[i] !== attempt[i]) {
308
+ data.incorrect = true;
309
+ break;
310
+ }
311
+ }
312
+ if (!data.incorrect) {
313
+ data.correct = true;
314
+ }
315
+ }
316
+ }
249
317
  }
250
318
  catch (e) {
251
319
  console.error(e);
@@ -8,6 +8,20 @@ export declare const ERRORS: {
8
8
  SUBSCRIPTION_EXPIRED: string;
9
9
  PERMISSION_INVALID: string;
10
10
  };
11
+ export declare enum EGrammarType {
12
+ QUESTION = 0,
13
+ CARD = 1,
14
+ CONCEPT = 2,
15
+ PSA_MULTI_QA = 3,
16
+ PSA_PRESCRIBE = 4,
17
+ PSA_QA = 5,
18
+ PSA_SBA = 6,
19
+ OSCE = 7,
20
+ BOOK = 8,
21
+ EMQ_QUESTION = 9,
22
+ SJT_QUESTION = 10,
23
+ RA_QUESTION = 11
24
+ }
11
25
  export declare const FCM_TOPICS: {
12
26
  GLOBAL: string;
13
27
  QBANK: string;
package/dist/mjs/index.js CHANGED
@@ -9,6 +9,21 @@ export const ERRORS = {
9
9
  SUBSCRIPTION_EXPIRED: 'Expired subscription.',
10
10
  PERMISSION_INVALID: 'Invalid permission.',
11
11
  };
12
+ export var EGrammarType;
13
+ (function (EGrammarType) {
14
+ EGrammarType[EGrammarType["QUESTION"] = 0] = "QUESTION";
15
+ EGrammarType[EGrammarType["CARD"] = 1] = "CARD";
16
+ EGrammarType[EGrammarType["CONCEPT"] = 2] = "CONCEPT";
17
+ EGrammarType[EGrammarType["PSA_MULTI_QA"] = 3] = "PSA_MULTI_QA";
18
+ EGrammarType[EGrammarType["PSA_PRESCRIBE"] = 4] = "PSA_PRESCRIBE";
19
+ EGrammarType[EGrammarType["PSA_QA"] = 5] = "PSA_QA";
20
+ EGrammarType[EGrammarType["PSA_SBA"] = 6] = "PSA_SBA";
21
+ EGrammarType[EGrammarType["OSCE"] = 7] = "OSCE";
22
+ EGrammarType[EGrammarType["BOOK"] = 8] = "BOOK";
23
+ EGrammarType[EGrammarType["EMQ_QUESTION"] = 9] = "EMQ_QUESTION";
24
+ EGrammarType[EGrammarType["SJT_QUESTION"] = 10] = "SJT_QUESTION";
25
+ EGrammarType[EGrammarType["RA_QUESTION"] = 11] = "RA_QUESTION";
26
+ })(EGrammarType || (EGrammarType = {}));
12
27
  export const FCM_TOPICS = {
13
28
  GLOBAL: 'global',
14
29
  QBANK: 'qbank',
@@ -18,7 +18,12 @@ export declare enum EQuestionType {
18
18
  SINGLE_BEST_ANSWER = 1,
19
19
  QUESTION_ANSWER = 2,
20
20
  MULTIPLE_ANSWERS = 3,
21
- PRESCRIPTION_ANSWER = 4
21
+ PRESCRIPTION_ANSWER = 4,
22
+ EXTENDED_MATCHING_ANSWER = 5,
23
+ SELECT_THREE_ANSWER = 6,
24
+ RANKING_ANSWER = 7,
25
+ MRCP_PART_1 = 8,
26
+ MRCP_PART_2 = 9
22
27
  }
23
28
  export declare enum EQuestionLike {
24
29
  NONE = 0,
@@ -53,8 +58,8 @@ export interface IQuestionCommentLike {
53
58
  comment: IQuestionComment;
54
59
  likeTrueDislikeFalse: boolean;
55
60
  }
56
- export type IQuestionAnswer = string | [string] | [IQuestionQAAnswer] | [string[], string[]] | IPrescribeAnswer[];
57
- export type IQuestionAll = IQuestion | IQuestionSBA | IQuestionQA | IQuestionMultiQ | IQuestionPrescribe;
61
+ export type IQuestionAnswer = string | [string] | [IQuestionQAAnswer] | [string[], string[]] | IPrescribeAnswer[] | [string, string][] | [string, string, string] | string[];
62
+ export type IQuestionAll = IQuestion | IQuestionSBA | IQuestionQA | IQuestionMultiQ | IQuestionPrescribe | IQuestionEMQ | IQuestionSelect3 | IQuestionRanking;
58
63
  export interface IQuestion {
59
64
  id: Id;
60
65
  createdAt: Date | number;
@@ -70,6 +75,7 @@ export interface IQuestion {
70
75
  answer: IQuestionAnswer;
71
76
  totalVotes: number;
72
77
  choices: IQuestionChoice[];
78
+ cases?: IQuestionCase[];
73
79
  topic?: ITopic;
74
80
  pictures?: IPicture[];
75
81
  difficulty: EDifficultyType;
@@ -111,6 +117,14 @@ export interface IQuestionChoice {
111
117
  votes: number;
112
118
  picture?: IPicture | null;
113
119
  }
120
+ export interface IQuestionCase {
121
+ id: Id;
122
+ updatedAt: number | Date;
123
+ questionId: Id;
124
+ case: string;
125
+ explanation: string;
126
+ label: string;
127
+ }
114
128
  export interface IQuestionElo {
115
129
  id: Id;
116
130
  date: number | Date;
@@ -145,10 +159,25 @@ export interface IQuestionQA extends IQuestion {
145
159
  qaAnswer: [IQuestionQAAnswer];
146
160
  }
147
161
  export declare function isQuestionMultiQ(data: IQuestionAll): data is IQuestionMultiQ;
162
+ export declare function isQuestionEMQ(data: IQuestionAll): data is IQuestionEMQ;
163
+ export declare function isQuestionSelect3(data: IQuestionAll): data is IQuestionSelect3;
164
+ export declare function isQuestionRanking(data: IQuestionAll): data is IQuestionRanking;
148
165
  export interface IQuestionMultiQ extends IQuestion {
149
166
  answer: [string[], string[]];
150
167
  multiAnswer: [string[], string[]];
151
168
  }
169
+ export interface IQuestionEMQ extends IQuestion {
170
+ answer: [string, string][];
171
+ emqAnswer: [string, string][];
172
+ }
173
+ export interface IQuestionSelect3 extends IQuestion {
174
+ answer: [string, string, string];
175
+ answerSelect3: [string, string, string];
176
+ }
177
+ export interface IQuestionRanking extends IQuestion {
178
+ answer: string[];
179
+ answerRanking: string[];
180
+ }
152
181
  export declare function isQuestionPrescribe(data: IQuestionAll): data is IQuestionPrescribe;
153
182
  export interface IQuestionPrescribe extends IQuestion {
154
183
  answer: IPrescribeAnswer[];
@@ -15,6 +15,11 @@ export var EQuestionType;
15
15
  EQuestionType[EQuestionType["QUESTION_ANSWER"] = 2] = "QUESTION_ANSWER";
16
16
  EQuestionType[EQuestionType["MULTIPLE_ANSWERS"] = 3] = "MULTIPLE_ANSWERS";
17
17
  EQuestionType[EQuestionType["PRESCRIPTION_ANSWER"] = 4] = "PRESCRIPTION_ANSWER";
18
+ EQuestionType[EQuestionType["EXTENDED_MATCHING_ANSWER"] = 5] = "EXTENDED_MATCHING_ANSWER";
19
+ EQuestionType[EQuestionType["SELECT_THREE_ANSWER"] = 6] = "SELECT_THREE_ANSWER";
20
+ EQuestionType[EQuestionType["RANKING_ANSWER"] = 7] = "RANKING_ANSWER";
21
+ EQuestionType[EQuestionType["MRCP_PART_1"] = 8] = "MRCP_PART_1";
22
+ EQuestionType[EQuestionType["MRCP_PART_2"] = 9] = "MRCP_PART_2";
18
23
  })(EQuestionType || (EQuestionType = {}));
19
24
  export var EQuestionLike;
20
25
  (function (EQuestionLike) {
@@ -31,6 +36,15 @@ export function isQuestionQA(data) {
31
36
  export function isQuestionMultiQ(data) {
32
37
  return data.typeId === EQuestionType.MULTIPLE_ANSWERS;
33
38
  }
39
+ export function isQuestionEMQ(data) {
40
+ return data.typeId === EQuestionType.EXTENDED_MATCHING_ANSWER;
41
+ }
42
+ export function isQuestionSelect3(data) {
43
+ return data.typeId === EQuestionType.SELECT_THREE_ANSWER;
44
+ }
45
+ export function isQuestionRanking(data) {
46
+ return data.typeId === EQuestionType.RANKING_ANSWER;
47
+ }
34
48
  export function isQuestionPrescribe(data) {
35
49
  return data.typeId === EQuestionType.PRESCRIPTION_ANSWER;
36
50
  }
@@ -44,6 +44,7 @@ export const VIDEO = gql `
44
44
  candidateBrief
45
45
  examinerBrief
46
46
  actorBrief
47
+ explanation
47
48
  marks {
48
49
  id
49
50
  index
@@ -101,6 +101,7 @@ export const SAMPLE_VIDEO = gql `
101
101
  candidateBrief
102
102
  examinerBrief
103
103
  actorBrief
104
+ explanation
104
105
  marks {
105
106
  id
106
107
  index
@@ -135,6 +135,15 @@ export function formatPrescribeAnswer(baseAnswer) {
135
135
  }
136
136
  return obj;
137
137
  }
138
+ function createHashMap(arr) {
139
+ const map = new Map();
140
+ for (const innerArr of arr) {
141
+ const sortedInnerArr = innerArr.slice().sort();
142
+ const key = sortedInnerArr.join('|');
143
+ map.set(key, (map.get(key) || 0) + 1);
144
+ }
145
+ return map;
146
+ }
138
147
  export function correctMark(mark) {
139
148
  const data = {
140
149
  correct: false,
@@ -241,6 +250,65 @@ export function correctMark(mark) {
241
250
  data.incorrect = true;
242
251
  }
243
252
  }
253
+ else if (EQuestionType.EXTENDED_MATCHING_ANSWER === mark.question.typeId) {
254
+ const extendedAnswer = answer;
255
+ const attempt = jsonAnswer;
256
+ if (extendedAnswer.length !== attempt.length) {
257
+ data.incorrect = true;
258
+ }
259
+ else {
260
+ const map1 = createHashMap(extendedAnswer);
261
+ const map2 = createHashMap(attempt);
262
+ for (const [key, value] of map1) {
263
+ if (map2.get(key) !== value) {
264
+ data.incorrect = true;
265
+ break;
266
+ }
267
+ }
268
+ if (!data.incorrect) {
269
+ data.correct = true;
270
+ }
271
+ }
272
+ }
273
+ else if (EQuestionType.SELECT_THREE_ANSWER === mark.question.typeId) {
274
+ const threeAnswer = answer;
275
+ const attempt = jsonAnswer;
276
+ if (threeAnswer.length !== 3) {
277
+ data.incorrect = true;
278
+ }
279
+ else {
280
+ const answerSet = new Set(threeAnswer);
281
+ for (const attemptLabel of attempt) {
282
+ if (!answerSet.has(attemptLabel)) {
283
+ data.incorrect = true;
284
+ break;
285
+ }
286
+ }
287
+ if (!data.incorrect) {
288
+ data.correct = true;
289
+ }
290
+ }
291
+ }
292
+ else if (EQuestionType.RANKING_ANSWER === mark.question.typeId) {
293
+ // Duplicate logic to Extended Matching, but they have different scoring systems
294
+ // which we may add at a later point
295
+ const rankAnswer = answer;
296
+ const attempt = jsonAnswer;
297
+ if (rankAnswer.length !== attempt.length) {
298
+ data.incorrect = true;
299
+ }
300
+ else {
301
+ for (let i = 0; i < rankAnswer.length; i++) {
302
+ if (rankAnswer[i] !== attempt[i]) {
303
+ data.incorrect = true;
304
+ break;
305
+ }
306
+ }
307
+ if (!data.incorrect) {
308
+ data.correct = true;
309
+ }
310
+ }
311
+ }
244
312
  }
245
313
  catch (e) {
246
314
  console.error(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.5.35",
3
+ "version": "2.5.37",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",