@quesmed/types 1.0.13 → 1.0.17
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/MockTest.d.ts +1 -0
- package/models/OsceMarksheet.d.ts +16 -7
- package/models/OsceMarksheet.js +1 -0
- 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 +3 -2
- 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 +7 -22
- package/resolvers/subscription/osce.js +22 -5
- package/utils/commonFunctions.js +7 -3
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/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 {
|
|
@@ -43,7 +44,7 @@ export interface ISaveOsceMarksheetVar {
|
|
|
43
44
|
}
|
|
44
45
|
export declare type ISaveOsceMarksheetData = number;
|
|
45
46
|
export interface IOsceMarksheetActionsVar {
|
|
46
|
-
|
|
47
|
+
osceMarksheetId: Id;
|
|
47
48
|
userId: Id;
|
|
48
49
|
timeRemaining?: number;
|
|
49
50
|
action: EOsceMarksheetAction;
|
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 {
|
|
@@ -6,36 +6,21 @@ export interface IOsceGroupMember {
|
|
|
6
6
|
user: IUser | null;
|
|
7
7
|
}
|
|
8
8
|
export interface IOsceGroup {
|
|
9
|
+
osceMarksheetId: Id;
|
|
9
10
|
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
|
-
];
|
|
11
|
+
members: IOsceMarksheetUser[];
|
|
28
12
|
}
|
|
29
|
-
export declare const OsceGroupInit:
|
|
13
|
+
export declare const OsceGroupInit: (osceMarksheetId: number) => IOsceMarksheetUser[];
|
|
30
14
|
export interface IRoleChangedVar {
|
|
31
|
-
|
|
15
|
+
osceMarksheetId: Id;
|
|
32
16
|
}
|
|
33
17
|
export interface IRoleChangedData extends IOsceGroup {
|
|
34
18
|
}
|
|
35
19
|
export interface IOsceMarksheetActionsVar {
|
|
36
|
-
|
|
20
|
+
osceMarksheetId: Id;
|
|
37
21
|
}
|
|
38
22
|
export interface IOsceMarksheetAction {
|
|
23
|
+
osceMarksheetId: Id;
|
|
39
24
|
agoraId: string;
|
|
40
25
|
userId: Id;
|
|
41
26
|
startedAt: Date | null;
|
|
@@ -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,7 +71,10 @@ function correctMark(mark) {
|
|
|
70
71
|
if (!mark || !mark.mark) {
|
|
71
72
|
return data;
|
|
72
73
|
}
|
|
73
|
-
const
|
|
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];
|
|
74
78
|
const flatAttempt = mark.mark[0];
|
|
75
79
|
if (models_1.EQuestionType.SINGLE_BEST_ANSWER === mark.question.typeId) {
|
|
76
80
|
const answer = flatAnswer;
|
|
@@ -93,7 +97,7 @@ function correctMark(mark) {
|
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
else if (models_1.EQuestionType.MULTIPLE_ANSWERS === mark.question.typeId) {
|
|
96
|
-
const [answerA, answerB] =
|
|
100
|
+
const [answerA, answerB] = answer.map((x) => x.sort());
|
|
97
101
|
const [attemptA, attemptB] = mark.mark.map((x) => x.sort());
|
|
98
102
|
if (answerA.length !== attemptA.length || answerB.length !== attemptB.length) {
|
|
99
103
|
data.incorrect = true;
|
|
@@ -106,7 +110,7 @@ function correctMark(mark) {
|
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
112
|
else if (models_1.EQuestionType.PRESCRIPTION_ANSWER === mark.question.typeId) {
|
|
109
|
-
const answers =
|
|
113
|
+
const answers = answer.map(formatPrescribeAnswer);
|
|
110
114
|
const attempt = formatPrescribeAnswer(flatAttempt);
|
|
111
115
|
let foundCorrect = false;
|
|
112
116
|
let index = 0;
|