@quesmed/types 1.4.5 → 1.4.9
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/Author.d.ts +2 -2
- package/models/Book.d.ts +3 -3
- package/models/Card.d.ts +2 -2
- package/models/Chapter.d.ts +2 -2
- package/models/Concept.d.ts +2 -2
- package/models/Feedback.d.ts +1 -1
- package/models/File.d.ts +2 -2
- package/models/Marksheet.d.ts +3 -3
- package/models/MockTest.d.ts +2 -2
- package/models/OsceMarksheet.d.ts +5 -5
- package/models/OsceStation.d.ts +2 -2
- package/models/Picture.d.ts +2 -2
- package/models/Picture.js +0 -4
- package/models/Picture.mjs +0 -4
- package/models/Promo.d.ts +2 -2
- package/models/Subscription.d.ts +1 -1
- package/models/Todo.d.ts +2 -2
- package/models/User.d.ts +13 -13
- package/models/Video.d.ts +11 -11
- package/package.json +1 -1
- package/resolvers/fragments/osce.js +1 -1
- package/resolvers/fragments/osce.mjs +1 -1
- package/resolvers/mutation/restricted/osce.d.ts +1 -1
- package/resolvers/mutation/restricted/osce.js +5 -5
- package/resolvers/mutation/restricted/osce.mjs +6 -6
- package/resolvers/mutation/restricted/users.d.ts +1 -1
- package/resolvers/query/restricted/marksheet.d.ts +2 -2
- package/resolvers/query/restricted/university.d.ts +1 -1
- package/resolvers/query/restricted/user.d.ts +1 -1
- package/utils/commonFunctions.js +21 -9
- package/utils/commonFunctions.mjs +21 -9
package/models/Author.d.ts
CHANGED
package/models/Book.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { IAuthor } from './Author';
|
|
|
2
2
|
import { Id } from './Type';
|
|
3
3
|
export interface IBook {
|
|
4
4
|
id: Id;
|
|
5
|
-
createdAt:
|
|
6
|
-
updatedAt:
|
|
5
|
+
createdAt: number | Date;
|
|
6
|
+
updatedAt: number | Date;
|
|
7
7
|
name: string;
|
|
8
8
|
publisher: string;
|
|
9
|
-
publishDate:
|
|
9
|
+
publishDate: number | Date;
|
|
10
10
|
pages: number;
|
|
11
11
|
format: string;
|
|
12
12
|
language: string;
|
package/models/Card.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { ITopic } from './Topic';
|
|
|
4
4
|
import { Id } from './Type';
|
|
5
5
|
export interface ICard {
|
|
6
6
|
id: Id;
|
|
7
|
-
createdAt:
|
|
8
|
-
updatedAt:
|
|
7
|
+
createdAt: number | Date;
|
|
8
|
+
updatedAt: number | Date;
|
|
9
9
|
topic: ITopic;
|
|
10
10
|
conceptId: Id;
|
|
11
11
|
concept: IConcept;
|
package/models/Chapter.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { ETopicType } from './Topic';
|
|
|
4
4
|
import { Id } from './Type';
|
|
5
5
|
export interface IChapter {
|
|
6
6
|
id: Id;
|
|
7
|
-
createdAt:
|
|
8
|
-
updatedAt:
|
|
7
|
+
createdAt: number | Date;
|
|
8
|
+
updatedAt: number | Date;
|
|
9
9
|
explanation: string | null;
|
|
10
10
|
typeId: ETopicType | null;
|
|
11
11
|
pictures: IChapterPicture[];
|
package/models/Concept.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Id } from './Type';
|
|
|
4
4
|
import { IVideo } from './Video';
|
|
5
5
|
export interface IConcept {
|
|
6
6
|
id: Id;
|
|
7
|
-
createdAt:
|
|
8
|
-
updatedAt:
|
|
7
|
+
createdAt: number | Date;
|
|
8
|
+
updatedAt: number | Date;
|
|
9
9
|
name: string;
|
|
10
10
|
chapterId: Id;
|
|
11
11
|
chapter: IChapter;
|
package/models/Feedback.d.ts
CHANGED
package/models/File.d.ts
CHANGED
package/models/Marksheet.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { IPrescribeMark, IQuestion, IQuestionQAAnswer } from './Question';
|
|
|
2
2
|
import { Id } from './Type';
|
|
3
3
|
export interface IMarksheet {
|
|
4
4
|
id: Id;
|
|
5
|
-
createdAt:
|
|
6
|
-
endedAt:
|
|
5
|
+
createdAt: number | Date;
|
|
6
|
+
endedAt: number | Date;
|
|
7
7
|
source: string;
|
|
8
8
|
marks: IMarksheetMark[];
|
|
9
9
|
mockTestId: number | null;
|
|
@@ -32,7 +32,7 @@ export interface IMarksheetMark {
|
|
|
32
32
|
export interface IDiscussion {
|
|
33
33
|
username: string;
|
|
34
34
|
userId: Id;
|
|
35
|
-
createdAt:
|
|
35
|
+
createdAt: number | Date;
|
|
36
36
|
comment: string;
|
|
37
37
|
like: number;
|
|
38
38
|
dislike: number;
|
package/models/MockTest.d.ts
CHANGED
|
@@ -16,6 +16,6 @@ export interface IUserMockTest {
|
|
|
16
16
|
incorrect: number;
|
|
17
17
|
totalQuestions: number;
|
|
18
18
|
lastMarksheetId?: Id;
|
|
19
|
-
lastMarksheetStartedAt?:
|
|
20
|
-
lastMarksheetEndedAt?:
|
|
19
|
+
lastMarksheetStartedAt?: number | Date;
|
|
20
|
+
lastMarksheetEndedAt?: number | Date;
|
|
21
21
|
}
|
|
@@ -3,7 +3,7 @@ import { Id } from './Type';
|
|
|
3
3
|
import { IUser } from './User';
|
|
4
4
|
export interface IOsceMarksheetUser {
|
|
5
5
|
id: Id | null;
|
|
6
|
-
createdAt:
|
|
6
|
+
createdAt: number | Date | null;
|
|
7
7
|
osceMarksheetId: Id;
|
|
8
8
|
userId: Id | null;
|
|
9
9
|
user: IUser | null;
|
|
@@ -38,8 +38,8 @@ export declare enum EOsceMarksheetAction {
|
|
|
38
38
|
}
|
|
39
39
|
export interface IOsceMarksheet {
|
|
40
40
|
id: Id;
|
|
41
|
-
createdAt:
|
|
42
|
-
updatedAt:
|
|
41
|
+
createdAt: number | Date;
|
|
42
|
+
updatedAt: number | Date;
|
|
43
43
|
timeTaken: number;
|
|
44
44
|
osceStationId: Id;
|
|
45
45
|
osceStation?: IOsceStation;
|
|
@@ -53,8 +53,8 @@ export interface IOsceMarksheet {
|
|
|
53
53
|
readingTime: number;
|
|
54
54
|
stationTime: number;
|
|
55
55
|
feedbackTime: number;
|
|
56
|
-
startedAt:
|
|
57
|
-
endedAt:
|
|
56
|
+
startedAt: number | Date;
|
|
57
|
+
endedAt: number | Date;
|
|
58
58
|
timeRemaining: number;
|
|
59
59
|
marks: IOsceMarksheetMark[];
|
|
60
60
|
users: IOsceMarksheetUser[];
|
package/models/OsceStation.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export declare enum EOsceType {
|
|
|
24
24
|
}
|
|
25
25
|
export interface IOsceStation {
|
|
26
26
|
id: Id;
|
|
27
|
-
createdAt:
|
|
28
|
-
updatedAt:
|
|
27
|
+
createdAt: number | Date;
|
|
28
|
+
updatedAt: number | Date;
|
|
29
29
|
name: string;
|
|
30
30
|
osceTypeId: Id;
|
|
31
31
|
osceType?: IOsceType;
|
package/models/Picture.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ITopic } from './Topic';
|
|
|
2
2
|
import { Id } from './Type';
|
|
3
3
|
export interface IPicture {
|
|
4
4
|
id: Id;
|
|
5
|
-
createdAt:
|
|
6
|
-
updatedAt:
|
|
5
|
+
createdAt: number | Date;
|
|
6
|
+
updatedAt: number | Date;
|
|
7
7
|
name: string;
|
|
8
8
|
caption: string;
|
|
9
9
|
path: string;
|
package/models/Picture.js
CHANGED
package/models/Promo.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Id } from './Type';
|
|
2
2
|
export interface ICoupon {
|
|
3
3
|
id: Id;
|
|
4
|
-
createdAt:
|
|
4
|
+
createdAt: number | Date;
|
|
5
5
|
name: string;
|
|
6
6
|
affiliateId: Id;
|
|
7
7
|
}
|
|
8
8
|
export interface IPromoReport {
|
|
9
9
|
id: Id;
|
|
10
|
-
date:
|
|
10
|
+
date: number | Date;
|
|
11
11
|
couponId: Id;
|
|
12
12
|
userId: Id;
|
|
13
13
|
subscriptionId: Id;
|
package/models/Subscription.d.ts
CHANGED
package/models/Todo.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ICard } from './Card';
|
|
|
2
2
|
import { Id } from './Type';
|
|
3
3
|
export interface ITodo {
|
|
4
4
|
id: Id;
|
|
5
|
-
createdAt:
|
|
6
|
-
updatedAt:
|
|
5
|
+
createdAt: number | Date;
|
|
6
|
+
updatedAt: number | Date;
|
|
7
7
|
userId: Id;
|
|
8
8
|
dailyTask: boolean;
|
|
9
9
|
marks: ITodoMark[];
|
package/models/User.d.ts
CHANGED
|
@@ -26,26 +26,26 @@ export interface IUser {
|
|
|
26
26
|
classYear: IClassYear;
|
|
27
27
|
graduationYear: number;
|
|
28
28
|
universityId: number;
|
|
29
|
-
examDate:
|
|
29
|
+
examDate: number | Date | null;
|
|
30
30
|
stripeCustomerId: string;
|
|
31
31
|
qBankSubscriptionId: Id | null;
|
|
32
32
|
qBankSubscription: ISubscription | null;
|
|
33
|
-
stripeQBankSubscriptionEndDate:
|
|
33
|
+
stripeQBankSubscriptionEndDate: number | Date | null;
|
|
34
34
|
osceSubscriptionId: Id | null;
|
|
35
35
|
osceSubscription: ISubscription | null;
|
|
36
|
-
stripeOsceSubscriptionEndDate:
|
|
36
|
+
stripeOsceSubscriptionEndDate: number | Date | null;
|
|
37
37
|
bundleSubscriptionId: Id | null;
|
|
38
38
|
bundleSubscription: ISubscription | null;
|
|
39
|
-
stripeBundleSubscriptionEndDate:
|
|
39
|
+
stripeBundleSubscriptionEndDate: number | Date | null;
|
|
40
40
|
subscriptionId: Id | null;
|
|
41
41
|
subscription?: ISubscription | null;
|
|
42
|
-
stripeSubscriptionEndDate:
|
|
42
|
+
stripeSubscriptionEndDate: number | Date | null;
|
|
43
43
|
stripePriceNickname: string | null;
|
|
44
44
|
}
|
|
45
45
|
export interface IUserCompletedQuestions {
|
|
46
46
|
id: Id;
|
|
47
|
-
createdAt:
|
|
48
|
-
updatedAt:
|
|
47
|
+
createdAt: number | Date;
|
|
48
|
+
updatedAt: number | Date;
|
|
49
49
|
questionId: Id;
|
|
50
50
|
userId: Id;
|
|
51
51
|
correct: boolean;
|
|
@@ -55,22 +55,22 @@ export interface IUserCompletedQuestions {
|
|
|
55
55
|
}
|
|
56
56
|
export interface IUserCompletedCards {
|
|
57
57
|
id: Id;
|
|
58
|
-
createdAt:
|
|
59
|
-
updatedAt:
|
|
58
|
+
createdAt: number | Date;
|
|
59
|
+
updatedAt: number | Date;
|
|
60
60
|
cardId: Id;
|
|
61
61
|
card: ICard;
|
|
62
62
|
userId: Id;
|
|
63
63
|
topic: ITopic;
|
|
64
64
|
concept: IConcept;
|
|
65
|
-
lastSeen:
|
|
65
|
+
lastSeen: number | Date;
|
|
66
66
|
score: number;
|
|
67
67
|
iteration: number;
|
|
68
68
|
optimalFactor: number;
|
|
69
69
|
}
|
|
70
70
|
export interface IUserFlaggedQuestions {
|
|
71
71
|
id: Id;
|
|
72
|
-
createdAt:
|
|
73
|
-
updatedAt:
|
|
72
|
+
createdAt: number | Date;
|
|
73
|
+
updatedAt: number | Date;
|
|
74
74
|
questionId: Id;
|
|
75
75
|
question: IQuestion;
|
|
76
76
|
userId: Id;
|
|
@@ -79,7 +79,7 @@ export interface IUserFlaggedQuestions {
|
|
|
79
79
|
}
|
|
80
80
|
export interface IUserProgress {
|
|
81
81
|
id: Id;
|
|
82
|
-
date:
|
|
82
|
+
date: number | Date;
|
|
83
83
|
userId: Id;
|
|
84
84
|
topicId: Id;
|
|
85
85
|
count: number;
|
package/models/Video.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IConcept } from
|
|
2
|
-
import { IFile } from
|
|
3
|
-
import { Id } from
|
|
1
|
+
import { IConcept } from './Concept';
|
|
2
|
+
import { IFile } from './File';
|
|
3
|
+
import { Id } from './Type';
|
|
4
4
|
export interface IVideo {
|
|
5
5
|
id: Id;
|
|
6
|
-
createdAt:
|
|
7
|
-
updatedAt:
|
|
8
|
-
startTime:
|
|
9
|
-
endTime:
|
|
6
|
+
createdAt: number | Date;
|
|
7
|
+
updatedAt: number | Date;
|
|
8
|
+
startTime: number | Date;
|
|
9
|
+
endTime: number | Date;
|
|
10
10
|
title: string;
|
|
11
11
|
museId: string;
|
|
12
12
|
thumbnail: string;
|
|
@@ -16,8 +16,8 @@ export interface IVideo {
|
|
|
16
16
|
duration: number;
|
|
17
17
|
concepts: IConcept[];
|
|
18
18
|
files: IFile[];
|
|
19
|
-
send1hrPushAt:
|
|
20
|
-
sent1hrPushAt:
|
|
21
|
-
send24hrPushAt:
|
|
22
|
-
sent24hrPushAt:
|
|
19
|
+
send1hrPushAt: number | Date | null;
|
|
20
|
+
sent1hrPushAt: number | Date | null;
|
|
21
|
+
send24hrPushAt: number | Date | null;
|
|
22
|
+
sent24hrPushAt: number | Date | null;
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -75,7 +75,7 @@ exports.OSCE_STATION_FIELDS = (0, client_1.gql) `
|
|
|
75
75
|
exports.OSCE_MARKSHEET_USER_FIELDS = (0, client_1.gql) `
|
|
76
76
|
${user_1.USER_FIELDS}
|
|
77
77
|
fragment OsceMarksheetUserFields on OsceMarksheetUser {
|
|
78
|
-
id
|
|
78
|
+
# id - do not pass otherwise all unassigned roles = candidate
|
|
79
79
|
osceMarksheetId
|
|
80
80
|
userId
|
|
81
81
|
user {
|
|
@@ -72,7 +72,7 @@ export const OSCE_STATION_FIELDS = gql `
|
|
|
72
72
|
export const OSCE_MARKSHEET_USER_FIELDS = gql `
|
|
73
73
|
${USER_FIELDS}
|
|
74
74
|
fragment OsceMarksheetUserFields on OsceMarksheetUser {
|
|
75
|
-
id
|
|
75
|
+
# id - do not pass otherwise all unassigned roles = candidate
|
|
76
76
|
osceMarksheetId
|
|
77
77
|
userId
|
|
78
78
|
user {
|
|
@@ -34,7 +34,7 @@ export interface IChangeOsceRoleVar {
|
|
|
34
34
|
export declare type IChangeOsceRoleData = RestrictedData<graphqlNormalize & IOsceMarksheet, 'changeOsceRole'>;
|
|
35
35
|
export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").DocumentNode;
|
|
36
36
|
export interface IMarkOsceMarksheetMarkVar {
|
|
37
|
-
|
|
37
|
+
osceMarksheetMarkId: Id;
|
|
38
38
|
mark: boolean;
|
|
39
39
|
}
|
|
40
40
|
export declare type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
|
|
@@ -63,14 +63,14 @@ exports.CHANGE_OSCE_ROLE = (0, client_1.gql) `
|
|
|
63
63
|
}
|
|
64
64
|
`;
|
|
65
65
|
exports.MARK_OSCE_MARKSHEET_MARK = (0, client_1.gql) `
|
|
66
|
-
${
|
|
67
|
-
mutation MarkOsceMarksheetMark($osceStationMarkId: Int!, $mark: Boolean!) {
|
|
66
|
+
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Boolean!) {
|
|
68
67
|
restricted {
|
|
69
68
|
markOsceMarksheetMark(
|
|
70
|
-
|
|
69
|
+
osceMarksheetMarkId: $osceMarksheetMarkId
|
|
71
70
|
mark: $mark
|
|
72
71
|
) {
|
|
73
|
-
|
|
72
|
+
id
|
|
73
|
+
mark
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -79,7 +79,7 @@ const optimisticMarkOsceMarksheetMark = (variables) => {
|
|
|
79
79
|
return {
|
|
80
80
|
restricted: {
|
|
81
81
|
markOsceMarksheetMark: {
|
|
82
|
-
id: variables.
|
|
82
|
+
id: variables.osceMarksheetMarkId,
|
|
83
83
|
mark: variables.mark,
|
|
84
84
|
__typename: 'OsceMarksheetMark',
|
|
85
85
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
-
import { OSCE_MARKSHEET_FIELDS,
|
|
2
|
+
import { OSCE_MARKSHEET_FIELDS, OSCE_MATCHMAKING_ACTION_FIELDS, } from '../../fragments/osce';
|
|
3
3
|
export const START_OSCE_MATCHMAKING = gql `
|
|
4
4
|
mutation StartOsceMatchmaking($agoraId: String!) {
|
|
5
5
|
restricted {
|
|
@@ -60,14 +60,14 @@ export const CHANGE_OSCE_ROLE = gql `
|
|
|
60
60
|
}
|
|
61
61
|
`;
|
|
62
62
|
export const MARK_OSCE_MARKSHEET_MARK = gql `
|
|
63
|
-
${
|
|
64
|
-
mutation MarkOsceMarksheetMark($osceStationMarkId: Int!, $mark: Boolean!) {
|
|
63
|
+
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Boolean!) {
|
|
65
64
|
restricted {
|
|
66
65
|
markOsceMarksheetMark(
|
|
67
|
-
|
|
66
|
+
osceMarksheetMarkId: $osceMarksheetMarkId
|
|
68
67
|
mark: $mark
|
|
69
68
|
) {
|
|
70
|
-
|
|
69
|
+
id
|
|
70
|
+
mark
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -76,7 +76,7 @@ export const optimisticMarkOsceMarksheetMark = (variables) => {
|
|
|
76
76
|
return {
|
|
77
77
|
restricted: {
|
|
78
78
|
markOsceMarksheetMark: {
|
|
79
|
-
id: variables.
|
|
79
|
+
id: variables.osceMarksheetMarkId,
|
|
80
80
|
mark: variables.mark,
|
|
81
81
|
__typename: 'OsceMarksheetMark',
|
|
82
82
|
},
|
|
@@ -31,8 +31,8 @@ export interface IDashboardPastQuizzesInfoRes {
|
|
|
31
31
|
totalQuestions: number;
|
|
32
32
|
totalMarksheet: number;
|
|
33
33
|
isTestMarksheet: boolean;
|
|
34
|
-
startedAt:
|
|
35
|
-
endedAt:
|
|
34
|
+
startedAt: number | Date;
|
|
35
|
+
endedAt: number | Date;
|
|
36
36
|
}
|
|
37
37
|
export declare type IDashboardPastQuizzesInfoData = IDashboardPastQuizzesInfoRes[];
|
|
38
38
|
export declare type ILatestPastMarksheetIdVar = null;
|
|
@@ -7,7 +7,7 @@ export interface IUniversitiesRankSpeciality {
|
|
|
7
7
|
rank: number;
|
|
8
8
|
}
|
|
9
9
|
export interface IUniversityLeaderboard {
|
|
10
|
-
updatedAt:
|
|
10
|
+
updatedAt: number | Date | null;
|
|
11
11
|
month: IUniversitiesRankSpeciality[];
|
|
12
12
|
quarter: IUniversitiesRankSpeciality[];
|
|
13
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ISubscription, IUser } from '../../../models';
|
|
2
2
|
export declare type IDashboardUserVar = null;
|
|
3
3
|
export interface IDashboardUserData {
|
|
4
|
-
examDate:
|
|
4
|
+
examDate: number | Date;
|
|
5
5
|
totalQuestions: number;
|
|
6
6
|
completedQuestionsCount: number;
|
|
7
7
|
completedCorrectQuestionsCount: number;
|
package/utils/commonFunctions.js
CHANGED
|
@@ -36,7 +36,10 @@ function mapPrescribeMarkToAnswer(obj) {
|
|
|
36
36
|
exports.mapPrescribeMarkToAnswer = mapPrescribeMarkToAnswer;
|
|
37
37
|
function formatPrescribeAnswer(obj) {
|
|
38
38
|
obj.drug.value = obj.drug.value.toLowerCase().replace(/\s/g, '');
|
|
39
|
-
obj.route.value = obj.route.value
|
|
39
|
+
obj.route.value = obj.route.value
|
|
40
|
+
.toLowerCase()
|
|
41
|
+
.replace(/\s/g, '')
|
|
42
|
+
.replace(/\//g, '');
|
|
40
43
|
if (obj.route.value === 'oral') {
|
|
41
44
|
obj.route.value = 'po';
|
|
42
45
|
}
|
|
@@ -62,7 +65,8 @@ function formatPrescribeAnswer(obj) {
|
|
|
62
65
|
if (obj.units.value === 'milligram' || obj.units.value === 'milligrams') {
|
|
63
66
|
obj.units.value = 'mg';
|
|
64
67
|
}
|
|
65
|
-
else if (obj.units.value === 'microgram' ||
|
|
68
|
+
else if (obj.units.value === 'microgram' ||
|
|
69
|
+
obj.units.value === 'micrograms') {
|
|
66
70
|
obj.units.value = 'mcg';
|
|
67
71
|
}
|
|
68
72
|
else if (obj.units.value === 'gram' || obj.units.value === 'grams') {
|
|
@@ -91,17 +95,20 @@ function formatPrescribeAnswer(obj) {
|
|
|
91
95
|
if (obj.frequency.value === 'once-off') {
|
|
92
96
|
obj.frequency.value = 'stat';
|
|
93
97
|
}
|
|
94
|
-
else if (obj.frequency.value.includes('once') ||
|
|
98
|
+
else if (obj.frequency.value.includes('once') ||
|
|
99
|
+
(frequencyIncHourly && hourlyFreqInt === 24)) {
|
|
95
100
|
obj.frequency.value = 'od';
|
|
96
101
|
}
|
|
97
|
-
else if (obj.frequency.value.includes('nightly') ||
|
|
102
|
+
else if (obj.frequency.value.includes('nightly') ||
|
|
103
|
+
obj.frequency.value === 'on') {
|
|
98
104
|
obj.frequency.value = 'od';
|
|
99
105
|
}
|
|
100
106
|
else if (obj.frequency.value.includes('twice') ||
|
|
101
107
|
(frequencyIncHourly && hourlyFreqInt === 12)) {
|
|
102
108
|
obj.frequency.value = 'bd';
|
|
103
109
|
}
|
|
104
|
-
else if (obj.frequency.value.includes('trice') ||
|
|
110
|
+
else if (obj.frequency.value.includes('trice') ||
|
|
111
|
+
(frequencyIncHourly && hourlyFreqInt === 8)) {
|
|
105
112
|
obj.frequency.value = 'tds';
|
|
106
113
|
}
|
|
107
114
|
else if (frequencyIncHourly && hourlyFreqInt === 6) {
|
|
@@ -140,7 +147,9 @@ function correctMark(mark) {
|
|
|
140
147
|
}
|
|
141
148
|
}
|
|
142
149
|
else if (models_1.EQuestionType.QUESTION_ANSWER === mark.question.typeId) {
|
|
143
|
-
const answer = flatAnswer.dose
|
|
150
|
+
const answer = flatAnswer.dose
|
|
151
|
+
.toLowerCase()
|
|
152
|
+
.replace(/\s/g, '');
|
|
144
153
|
let attempt = '';
|
|
145
154
|
if (flatAttempt) {
|
|
146
155
|
attempt = flatAttempt.toLowerCase().replace(/\s/g, '');
|
|
@@ -161,7 +170,8 @@ function correctMark(mark) {
|
|
|
161
170
|
Array.isArray(mark.mark[1])) {
|
|
162
171
|
[attemptA, attemptB] = mark.mark.map((x) => x.sort());
|
|
163
172
|
}
|
|
164
|
-
if (answerA.length !== attemptA.length ||
|
|
173
|
+
if (answerA.length !== attemptA.length ||
|
|
174
|
+
answerB.length !== attemptB.length) {
|
|
165
175
|
data.incorrect = true;
|
|
166
176
|
}
|
|
167
177
|
else if (attemptA.every((x, i) => x === answerA[i]) &&
|
|
@@ -182,7 +192,8 @@ function correctMark(mark) {
|
|
|
182
192
|
frequency: '',
|
|
183
193
|
duration: '',
|
|
184
194
|
}));
|
|
185
|
-
if (typeof flatAttempt === 'object' &&
|
|
195
|
+
if (typeof flatAttempt === 'object' &&
|
|
196
|
+
Object.keys(flatAttempt).length === 6) {
|
|
186
197
|
attempt = formatPrescribeAnswer(mapPrescribeMarkToAnswer(flatAttempt));
|
|
187
198
|
}
|
|
188
199
|
let foundCorrect = false;
|
|
@@ -192,7 +203,8 @@ function correctMark(mark) {
|
|
|
192
203
|
const drugCorrect = answer.drug.display || answer.drug.value === attempt.drug.value;
|
|
193
204
|
const durationCorrect = answer.duration.display ||
|
|
194
205
|
answer.duration.value.split(',').includes(attempt.duration.value);
|
|
195
|
-
const frequencyCorrect = answer.frequency.display ||
|
|
206
|
+
const frequencyCorrect = answer.frequency.display ||
|
|
207
|
+
answer.frequency.value === attempt.frequency.value;
|
|
196
208
|
const routeCorrect = answer.route.display || answer.route.value === attempt.route.value;
|
|
197
209
|
const unitsCorrect = answer.units.display || answer.units.value === attempt.units.value;
|
|
198
210
|
if (doseCorrect &&
|
|
@@ -32,7 +32,10 @@ export function mapPrescribeMarkToAnswer(obj) {
|
|
|
32
32
|
}
|
|
33
33
|
export function formatPrescribeAnswer(obj) {
|
|
34
34
|
obj.drug.value = obj.drug.value.toLowerCase().replace(/\s/g, '');
|
|
35
|
-
obj.route.value = obj.route.value
|
|
35
|
+
obj.route.value = obj.route.value
|
|
36
|
+
.toLowerCase()
|
|
37
|
+
.replace(/\s/g, '')
|
|
38
|
+
.replace(/\//g, '');
|
|
36
39
|
if (obj.route.value === 'oral') {
|
|
37
40
|
obj.route.value = 'po';
|
|
38
41
|
}
|
|
@@ -58,7 +61,8 @@ export function formatPrescribeAnswer(obj) {
|
|
|
58
61
|
if (obj.units.value === 'milligram' || obj.units.value === 'milligrams') {
|
|
59
62
|
obj.units.value = 'mg';
|
|
60
63
|
}
|
|
61
|
-
else if (obj.units.value === 'microgram' ||
|
|
64
|
+
else if (obj.units.value === 'microgram' ||
|
|
65
|
+
obj.units.value === 'micrograms') {
|
|
62
66
|
obj.units.value = 'mcg';
|
|
63
67
|
}
|
|
64
68
|
else if (obj.units.value === 'gram' || obj.units.value === 'grams') {
|
|
@@ -87,17 +91,20 @@ export function formatPrescribeAnswer(obj) {
|
|
|
87
91
|
if (obj.frequency.value === 'once-off') {
|
|
88
92
|
obj.frequency.value = 'stat';
|
|
89
93
|
}
|
|
90
|
-
else if (obj.frequency.value.includes('once') ||
|
|
94
|
+
else if (obj.frequency.value.includes('once') ||
|
|
95
|
+
(frequencyIncHourly && hourlyFreqInt === 24)) {
|
|
91
96
|
obj.frequency.value = 'od';
|
|
92
97
|
}
|
|
93
|
-
else if (obj.frequency.value.includes('nightly') ||
|
|
98
|
+
else if (obj.frequency.value.includes('nightly') ||
|
|
99
|
+
obj.frequency.value === 'on') {
|
|
94
100
|
obj.frequency.value = 'od';
|
|
95
101
|
}
|
|
96
102
|
else if (obj.frequency.value.includes('twice') ||
|
|
97
103
|
(frequencyIncHourly && hourlyFreqInt === 12)) {
|
|
98
104
|
obj.frequency.value = 'bd';
|
|
99
105
|
}
|
|
100
|
-
else if (obj.frequency.value.includes('trice') ||
|
|
106
|
+
else if (obj.frequency.value.includes('trice') ||
|
|
107
|
+
(frequencyIncHourly && hourlyFreqInt === 8)) {
|
|
101
108
|
obj.frequency.value = 'tds';
|
|
102
109
|
}
|
|
103
110
|
else if (frequencyIncHourly && hourlyFreqInt === 6) {
|
|
@@ -135,7 +142,9 @@ export function correctMark(mark) {
|
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
else if (EQuestionType.QUESTION_ANSWER === mark.question.typeId) {
|
|
138
|
-
const answer = flatAnswer.dose
|
|
145
|
+
const answer = flatAnswer.dose
|
|
146
|
+
.toLowerCase()
|
|
147
|
+
.replace(/\s/g, '');
|
|
139
148
|
let attempt = '';
|
|
140
149
|
if (flatAttempt) {
|
|
141
150
|
attempt = flatAttempt.toLowerCase().replace(/\s/g, '');
|
|
@@ -156,7 +165,8 @@ export function correctMark(mark) {
|
|
|
156
165
|
Array.isArray(mark.mark[1])) {
|
|
157
166
|
[attemptA, attemptB] = mark.mark.map((x) => x.sort());
|
|
158
167
|
}
|
|
159
|
-
if (answerA.length !== attemptA.length ||
|
|
168
|
+
if (answerA.length !== attemptA.length ||
|
|
169
|
+
answerB.length !== attemptB.length) {
|
|
160
170
|
data.incorrect = true;
|
|
161
171
|
}
|
|
162
172
|
else if (attemptA.every((x, i) => x === answerA[i]) &&
|
|
@@ -177,7 +187,8 @@ export function correctMark(mark) {
|
|
|
177
187
|
frequency: '',
|
|
178
188
|
duration: '',
|
|
179
189
|
}));
|
|
180
|
-
if (typeof flatAttempt === 'object' &&
|
|
190
|
+
if (typeof flatAttempt === 'object' &&
|
|
191
|
+
Object.keys(flatAttempt).length === 6) {
|
|
181
192
|
attempt = formatPrescribeAnswer(mapPrescribeMarkToAnswer(flatAttempt));
|
|
182
193
|
}
|
|
183
194
|
let foundCorrect = false;
|
|
@@ -187,7 +198,8 @@ export function correctMark(mark) {
|
|
|
187
198
|
const drugCorrect = answer.drug.display || answer.drug.value === attempt.drug.value;
|
|
188
199
|
const durationCorrect = answer.duration.display ||
|
|
189
200
|
answer.duration.value.split(',').includes(attempt.duration.value);
|
|
190
|
-
const frequencyCorrect = answer.frequency.display ||
|
|
201
|
+
const frequencyCorrect = answer.frequency.display ||
|
|
202
|
+
answer.frequency.value === attempt.frequency.value;
|
|
191
203
|
const routeCorrect = answer.route.display || answer.route.value === attempt.route.value;
|
|
192
204
|
const unitsCorrect = answer.units.display || answer.units.value === attempt.units.value;
|
|
193
205
|
if (doseCorrect &&
|