@quesmed/types 1.0.12 → 1.0.16
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/Feedback.d.ts +8 -0
- package/models/Feedback.js +2 -0
- package/models/Marksheet.d.ts +2 -1
- package/models/MockTest.d.ts +1 -0
- package/models/OsceMarksheet.d.ts +16 -7
- package/models/OsceMarksheet.js +1 -0
- package/models/Question.d.ts +2 -1
- package/models/Subscription.d.ts +1 -1
- package/models/index.d.ts +2 -1
- package/models/index.js +2 -1
- package/package.json +1 -1
- package/resolvers/mutation/restricted/osce.d.ts +2 -1
- package/resolvers/query/feedback.d.ts +3 -0
- package/resolvers/query/feedback.js +2 -0
- package/resolvers/query/index.d.ts +2 -0
- package/resolvers/query/index.js +2 -0
- package/resolvers/query/subscription.d.ts +3 -0
- package/resolvers/query/subscription.js +2 -0
- package/resolvers/subscription/osce.d.ts +3 -20
- package/resolvers/subscription/osce.js +22 -5
- package/utils/commonFunctions.js +13 -7
package/models/Marksheet.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare enum EQuestionLike {
|
|
|
13
13
|
DISLIKE = 1,
|
|
14
14
|
REMOVE = 2
|
|
15
15
|
}
|
|
16
|
+
export declare type IMarksheetMarkJSONB = string | [string] | [string[], string[]] | [IPrescribeAnswer] | null;
|
|
16
17
|
export interface IMarksheetMark {
|
|
17
18
|
id: Id;
|
|
18
19
|
index: number;
|
|
@@ -22,7 +23,7 @@ export interface IMarksheetMark {
|
|
|
22
23
|
flagged: boolean;
|
|
23
24
|
questionId: Id;
|
|
24
25
|
question: IQuestion;
|
|
25
|
-
mark:
|
|
26
|
+
mark: IMarksheetMarkJSONB;
|
|
26
27
|
like: number;
|
|
27
28
|
dislike: number;
|
|
28
29
|
isLikeByMe: string;
|
package/models/MockTest.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { IOsceStation, IOsceStationMark, IOsceType } from './OsceStation';
|
|
2
|
+
import { Id } from './Type';
|
|
3
|
+
import { IUser } from './User';
|
|
4
|
+
export interface IOsceMarksheetUser {
|
|
5
|
+
id: Id | null;
|
|
6
|
+
createdAt: Date | string | null;
|
|
7
|
+
osceMarksheetId: Id;
|
|
8
|
+
userId: Id | null;
|
|
9
|
+
user: IUser | null;
|
|
10
|
+
role: EOsceRoles;
|
|
11
|
+
}
|
|
4
12
|
export interface IOsceMarksheetMark {
|
|
5
13
|
id: Id;
|
|
6
14
|
mark: boolean;
|
|
@@ -23,7 +31,8 @@ export declare enum EOsceMarksheetAction {
|
|
|
23
31
|
CONTINUE = 4,
|
|
24
32
|
CONNECT = 5,
|
|
25
33
|
DISCONNECT = 6,
|
|
26
|
-
SELECT = 7
|
|
34
|
+
SELECT = 7,
|
|
35
|
+
LEFT = 8
|
|
27
36
|
}
|
|
28
37
|
export interface IOsceMarksheet {
|
|
29
38
|
id: Id;
|
|
@@ -32,9 +41,9 @@ export interface IOsceMarksheet {
|
|
|
32
41
|
timeTaken: number;
|
|
33
42
|
osceStationId: Id;
|
|
34
43
|
osceStation?: IOsceStation;
|
|
35
|
-
userId
|
|
44
|
+
userId?: Id;
|
|
45
|
+
role?: EOsceRoles;
|
|
36
46
|
solo: boolean;
|
|
37
|
-
role: EOsceRoles;
|
|
38
47
|
score: number;
|
|
39
48
|
globalScore: number;
|
|
40
49
|
feedback: string;
|
|
@@ -46,7 +55,7 @@ export interface IOsceMarksheet {
|
|
|
46
55
|
endedAt: Date | string;
|
|
47
56
|
timeRemaining: number;
|
|
48
57
|
marks: IOsceMarksheetMark[];
|
|
49
|
-
users:
|
|
58
|
+
users: IOsceMarksheetUser[];
|
|
50
59
|
completed: boolean;
|
|
51
60
|
}
|
|
52
61
|
export interface IDashboardOsce {
|
package/models/OsceMarksheet.js
CHANGED
|
@@ -18,4 +18,5 @@ var EOsceMarksheetAction;
|
|
|
18
18
|
EOsceMarksheetAction[EOsceMarksheetAction["CONNECT"] = 5] = "CONNECT";
|
|
19
19
|
EOsceMarksheetAction[EOsceMarksheetAction["DISCONNECT"] = 6] = "DISCONNECT";
|
|
20
20
|
EOsceMarksheetAction[EOsceMarksheetAction["SELECT"] = 7] = "SELECT";
|
|
21
|
+
EOsceMarksheetAction[EOsceMarksheetAction["LEFT"] = 8] = "LEFT";
|
|
21
22
|
})(EOsceMarksheetAction = exports.EOsceMarksheetAction || (exports.EOsceMarksheetAction = {}));
|
package/models/Question.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare enum EQuestionType {
|
|
|
7
7
|
MULTIPLE_ANSWERS = 3,
|
|
8
8
|
PRESCRIPTION_ANSWER = 4
|
|
9
9
|
}
|
|
10
|
+
export declare type IQuestionAnswer = [string] | [string[], string[]] | IPrescribeAnswer[];
|
|
10
11
|
export interface IQuestion {
|
|
11
12
|
id: Id;
|
|
12
13
|
typeId: Id;
|
|
@@ -15,7 +16,7 @@ export interface IQuestion {
|
|
|
15
16
|
concept?: IConcept;
|
|
16
17
|
question: string;
|
|
17
18
|
explanation?: string;
|
|
18
|
-
answer:
|
|
19
|
+
answer: IQuestionAnswer;
|
|
19
20
|
totalVotes: number;
|
|
20
21
|
choices: IQuestionChoice[];
|
|
21
22
|
pictures: IQuestionPicture[];
|
package/models/Subscription.d.ts
CHANGED
package/models/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './Card';
|
|
2
2
|
export * from './Chapter';
|
|
3
3
|
export * from './Concept';
|
|
4
|
+
export * from './Feedback';
|
|
4
5
|
export * from './File';
|
|
5
6
|
export * from './Marksheet';
|
|
6
7
|
export * from './MockTest';
|
|
@@ -14,6 +15,6 @@ export * from './Todo';
|
|
|
14
15
|
export * from './Token';
|
|
15
16
|
export * from './Topic';
|
|
16
17
|
export * from './Type';
|
|
18
|
+
export * from './University';
|
|
17
19
|
export * from './User';
|
|
18
20
|
export * from './Video';
|
|
19
|
-
export * from './University';
|
package/models/index.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./Card"), exports);
|
|
14
14
|
__exportStar(require("./Chapter"), exports);
|
|
15
15
|
__exportStar(require("./Concept"), exports);
|
|
16
|
+
__exportStar(require("./Feedback"), exports);
|
|
16
17
|
__exportStar(require("./File"), exports);
|
|
17
18
|
__exportStar(require("./Marksheet"), exports);
|
|
18
19
|
__exportStar(require("./MockTest"), exports);
|
|
@@ -26,6 +27,6 @@ __exportStar(require("./Todo"), exports);
|
|
|
26
27
|
__exportStar(require("./Token"), exports);
|
|
27
28
|
__exportStar(require("./Topic"), exports);
|
|
28
29
|
__exportStar(require("./Type"), exports);
|
|
30
|
+
__exportStar(require("./University"), exports);
|
|
29
31
|
__exportStar(require("./User"), exports);
|
|
30
32
|
__exportStar(require("./Video"), exports);
|
|
31
|
-
__exportStar(require("./University"), exports);
|
package/package.json
CHANGED
|
@@ -24,7 +24,8 @@ export interface ISelectOsceMarksheetStationVar {
|
|
|
24
24
|
osceMarksheetId: Id;
|
|
25
25
|
osceStationId: Id;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export interface ISelectOsceMarksheetStationData extends IOsceMarksheet {
|
|
28
|
+
}
|
|
28
29
|
export interface IStartOsceMarksheetData extends IOsceMarksheet {
|
|
29
30
|
}
|
|
30
31
|
export interface IPrestartOsceMarksheetVar {
|
package/resolvers/query/index.js
CHANGED
|
@@ -10,8 +10,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./feedback"), exports);
|
|
13
14
|
__exportStar(require("./sampleCards"), exports);
|
|
14
15
|
__exportStar(require("./sampleQuestions"), exports);
|
|
16
|
+
__exportStar(require("./subscription"), exports);
|
|
15
17
|
__exportStar(require("./university"), exports);
|
|
16
18
|
__exportStar(require("./user"), exports);
|
|
17
19
|
__exportStar(require("./video"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EOsceMarksheetAction, EOsceRoles, Id, IUser } from '../../models';
|
|
1
|
+
import { EOsceMarksheetAction, EOsceRoles, Id, IOsceMarksheetUser, IUser } from '../../models';
|
|
2
2
|
export declare const ROLE_CHANGED = "ROLE_CHANGED";
|
|
3
3
|
export declare const OSCE_MARKSHEET_ACTION = "OSCE_MARKSHEET_ACTION";
|
|
4
4
|
export interface IOsceGroupMember {
|
|
@@ -7,26 +7,9 @@ export interface IOsceGroupMember {
|
|
|
7
7
|
}
|
|
8
8
|
export interface IOsceGroup {
|
|
9
9
|
agoraId: string;
|
|
10
|
-
members: [
|
|
11
|
-
{
|
|
12
|
-
role: EOsceRoles.CANDIDATE;
|
|
13
|
-
user: IUser | null;
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
role: EOsceRoles.EXAMINER;
|
|
17
|
-
user: IUser | null;
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
role: EOsceRoles.ACTOR;
|
|
21
|
-
user: IUser | null;
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
role: EOsceRoles.OBSERVER;
|
|
25
|
-
user: IUser | null;
|
|
26
|
-
}
|
|
27
|
-
];
|
|
10
|
+
members: IOsceMarksheetUser[];
|
|
28
11
|
}
|
|
29
|
-
export declare const OsceGroupInit:
|
|
12
|
+
export declare const OsceGroupInit: (osceMarksheetId: number) => IOsceMarksheetUser[];
|
|
30
13
|
export interface IRoleChangedVar {
|
|
31
14
|
agoraId: string;
|
|
32
15
|
}
|
|
@@ -4,21 +4,38 @@ exports.OsceGroupInit = exports.OSCE_MARKSHEET_ACTION = exports.ROLE_CHANGED = v
|
|
|
4
4
|
const models_1 = require("../../models");
|
|
5
5
|
exports.ROLE_CHANGED = 'ROLE_CHANGED';
|
|
6
6
|
exports.OSCE_MARKSHEET_ACTION = 'OSCE_MARKSHEET_ACTION';
|
|
7
|
-
|
|
7
|
+
const OsceGroupInit = (osceMarksheetId) => [
|
|
8
8
|
{
|
|
9
|
-
|
|
9
|
+
id: null,
|
|
10
|
+
createdAt: null,
|
|
11
|
+
osceMarksheetId,
|
|
12
|
+
userId: null,
|
|
10
13
|
user: null,
|
|
14
|
+
role: models_1.EOsceRoles.CANDIDATE,
|
|
11
15
|
},
|
|
12
16
|
{
|
|
13
|
-
|
|
17
|
+
id: null,
|
|
18
|
+
createdAt: null,
|
|
19
|
+
osceMarksheetId,
|
|
20
|
+
userId: null,
|
|
14
21
|
user: null,
|
|
22
|
+
role: models_1.EOsceRoles.EXAMINER,
|
|
15
23
|
},
|
|
16
24
|
{
|
|
17
|
-
|
|
25
|
+
id: null,
|
|
26
|
+
createdAt: null,
|
|
27
|
+
osceMarksheetId,
|
|
28
|
+
userId: null,
|
|
18
29
|
user: null,
|
|
30
|
+
role: models_1.EOsceRoles.ACTOR,
|
|
19
31
|
},
|
|
20
32
|
{
|
|
21
|
-
|
|
33
|
+
id: null,
|
|
34
|
+
createdAt: null,
|
|
35
|
+
osceMarksheetId,
|
|
36
|
+
userId: null,
|
|
22
37
|
user: null,
|
|
38
|
+
role: models_1.EOsceRoles.OBSERVER,
|
|
23
39
|
},
|
|
24
40
|
];
|
|
41
|
+
exports.OsceGroupInit = OsceGroupInit;
|
package/utils/commonFunctions.js
CHANGED
|
@@ -61,6 +61,7 @@ function formatPrescribeAnswer(obj) {
|
|
|
61
61
|
}
|
|
62
62
|
return obj;
|
|
63
63
|
}
|
|
64
|
+
const answerRegex = /answer/gi;
|
|
64
65
|
function correctMark(mark) {
|
|
65
66
|
const data = {
|
|
66
67
|
correct: false,
|
|
@@ -70,9 +71,14 @@ function correctMark(mark) {
|
|
|
70
71
|
if (!mark || !mark.mark) {
|
|
71
72
|
return data;
|
|
72
73
|
}
|
|
74
|
+
const qKeys = Object.keys(mark.question);
|
|
75
|
+
const answerKey = qKeys.find((k) => answerRegex.exec(k)) || 'answer';
|
|
76
|
+
const answer = mark.question[answerKey];
|
|
77
|
+
const flatAnswer = answer[0];
|
|
78
|
+
const flatAttempt = mark.mark[0];
|
|
73
79
|
if (models_1.EQuestionType.SINGLE_BEST_ANSWER === mark.question.typeId) {
|
|
74
|
-
const answer =
|
|
75
|
-
const attempt =
|
|
80
|
+
const answer = flatAnswer;
|
|
81
|
+
const attempt = flatAttempt;
|
|
76
82
|
if (answer === attempt) {
|
|
77
83
|
data.correct = true;
|
|
78
84
|
}
|
|
@@ -81,8 +87,8 @@ function correctMark(mark) {
|
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
else if (models_1.EQuestionType.QUESTION_ANSWER === mark.question.typeId) {
|
|
84
|
-
const answer =
|
|
85
|
-
const attempt =
|
|
90
|
+
const answer = flatAnswer.toLowerCase().replace(/\s/g, '');
|
|
91
|
+
const attempt = flatAttempt.toLowerCase().replace(/\s/g, '');
|
|
86
92
|
if (answer === attempt) {
|
|
87
93
|
data.correct = true;
|
|
88
94
|
}
|
|
@@ -91,7 +97,7 @@ function correctMark(mark) {
|
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
else if (models_1.EQuestionType.MULTIPLE_ANSWERS === mark.question.typeId) {
|
|
94
|
-
const [answerA, answerB] =
|
|
100
|
+
const [answerA, answerB] = answer.map((x) => x.sort());
|
|
95
101
|
const [attemptA, attemptB] = mark.mark.map((x) => x.sort());
|
|
96
102
|
if (answerA.length !== attemptA.length || answerB.length !== attemptB.length) {
|
|
97
103
|
data.incorrect = true;
|
|
@@ -104,8 +110,8 @@ function correctMark(mark) {
|
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
112
|
else if (models_1.EQuestionType.PRESCRIPTION_ANSWER === mark.question.typeId) {
|
|
107
|
-
const answers =
|
|
108
|
-
const attempt = formatPrescribeAnswer(
|
|
113
|
+
const answers = answer.map(formatPrescribeAnswer);
|
|
114
|
+
const attempt = formatPrescribeAnswer(flatAttempt);
|
|
109
115
|
let foundCorrect = false;
|
|
110
116
|
let index = 0;
|
|
111
117
|
for (const answer of answers) {
|