@quesmed/types 2.6.259 → 2.6.260
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.
|
@@ -45,9 +45,11 @@ export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").Document
|
|
|
45
45
|
export interface IMarkOsceMarksheetMarkVar {
|
|
46
46
|
osceMarksheetMarkId: Id;
|
|
47
47
|
mark: number | EPaceMarkType;
|
|
48
|
+
corrected?: Boolean;
|
|
48
49
|
}
|
|
49
50
|
export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
|
|
50
51
|
export declare const optimisticMarkOsceMarksheetMark: (variables: IMarkOsceMarksheetMarkVar, productType: EProductType) => IMarkOsceMarksheetMarkData;
|
|
52
|
+
export declare const updateCacheOnMarkOsceMarksheetMark: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IMarkOsceMarksheetMarkData>, options: ApolloUpdateOptions<IMarkOsceMarksheetMarkVar>) => void;
|
|
51
53
|
export declare const SELECT_OSCE_STATION: import("@apollo/client").DocumentNode;
|
|
52
54
|
export interface ISelectOsceMarksheetStationVar {
|
|
53
55
|
osceMarksheetId: Id;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.END_VOICE_SESSION = exports.CREATE_VOICE_SESSION = exports.optimisticSetOsceMarksheetFeedback = exports.updateCacheOnSetOsceMarksheetFeedback = exports.SET_OSCE_MARKSHEET_FEEDBACK = exports.updateCacheOnAutoMarkOsceMarksheet = exports.AUTO_MARK_OSCE_MARKSHEET = exports.STREAM_OSCE_CHAT_MESSAGE = exports.LEAVE_OSCE_MARKSHEET = exports.optimisticEndOsceMarksheet = exports.updateCacheOnEndOsceMarksheet = exports.END_OSCE_MARKSHEET = exports.MODIFY_OSCE_MARKSHEET = exports.SAVE_OSCE_MARKSHEET = exports.PRESTART_OSCE_MARKSHEET = exports.START_OSCE_TIMER = exports.START_OSCE_MARKSHEET = exports.SELECT_OSCE_STATION = exports.optimisticMarkOsceMarksheetMark = exports.MARK_OSCE_MARKSHEET_MARK = exports.CHANGE_OSCE_ROLE = exports.BUILD_OSCE_MARKSHEET = exports.CREATE_OR_JOIN_OSCE_MARKSHEET = exports.CANCEL_OSCE_MATCHMAKING = exports.CHECK_OSCE_MATCHMAKING = exports.ACCEPT_OSCE_MATCHMAKING = exports.START_OSCE_MATCHMAKING = void 0;
|
|
3
|
+
exports.END_VOICE_SESSION = exports.CREATE_VOICE_SESSION = exports.optimisticSetOsceMarksheetFeedback = exports.updateCacheOnSetOsceMarksheetFeedback = exports.SET_OSCE_MARKSHEET_FEEDBACK = exports.updateCacheOnAutoMarkOsceMarksheet = exports.AUTO_MARK_OSCE_MARKSHEET = exports.STREAM_OSCE_CHAT_MESSAGE = exports.LEAVE_OSCE_MARKSHEET = exports.optimisticEndOsceMarksheet = exports.updateCacheOnEndOsceMarksheet = exports.END_OSCE_MARKSHEET = exports.MODIFY_OSCE_MARKSHEET = exports.SAVE_OSCE_MARKSHEET = exports.PRESTART_OSCE_MARKSHEET = exports.START_OSCE_TIMER = exports.START_OSCE_MARKSHEET = exports.SELECT_OSCE_STATION = exports.updateCacheOnMarkOsceMarksheetMark = exports.optimisticMarkOsceMarksheetMark = exports.MARK_OSCE_MARKSHEET_MARK = exports.CHANGE_OSCE_ROLE = exports.BUILD_OSCE_MARKSHEET = exports.CREATE_OR_JOIN_OSCE_MARKSHEET = exports.CANCEL_OSCE_MATCHMAKING = exports.CHECK_OSCE_MATCHMAKING = exports.ACCEPT_OSCE_MATCHMAKING = exports.START_OSCE_MATCHMAKING = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
5
|
const models_1 = require("../../../models");
|
|
6
6
|
const fragments_1 = require("../../fragments");
|
|
@@ -84,11 +84,12 @@ exports.CHANGE_OSCE_ROLE = (0, client_1.gql) `
|
|
|
84
84
|
}
|
|
85
85
|
`;
|
|
86
86
|
exports.MARK_OSCE_MARKSHEET_MARK = (0, client_1.gql) `
|
|
87
|
-
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int
|
|
87
|
+
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $corrected: Boolean) {
|
|
88
88
|
restricted {
|
|
89
89
|
markOsceMarksheetMark(
|
|
90
90
|
osceMarksheetMarkId: $osceMarksheetMarkId
|
|
91
91
|
mark: $mark
|
|
92
|
+
corrected: $corrected
|
|
92
93
|
) {
|
|
93
94
|
id
|
|
94
95
|
selectedChoice
|
|
@@ -118,6 +119,63 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
|
|
|
118
119
|
};
|
|
119
120
|
};
|
|
120
121
|
exports.optimisticMarkOsceMarksheetMark = optimisticMarkOsceMarksheetMark;
|
|
122
|
+
const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
|
|
123
|
+
const { markOsceMarksheetMark } = result?.data?.restricted || {};
|
|
124
|
+
const { variables } = options || {};
|
|
125
|
+
if (!variables || !markOsceMarksheetMark) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
cache.modify({
|
|
129
|
+
id: cache.identify({
|
|
130
|
+
id: variables.osceMarksheetMarkId,
|
|
131
|
+
__typename: 'OsceMarksheetMark',
|
|
132
|
+
}),
|
|
133
|
+
fields: {
|
|
134
|
+
selectedChoice: () => markOsceMarksheetMark.selectedChoice,
|
|
135
|
+
mark: () => markOsceMarksheetMark.mark,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
if (!variables.corrected) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const markEntity = cache.readFragment({
|
|
142
|
+
id: cache.identify({
|
|
143
|
+
id: variables.osceMarksheetMarkId,
|
|
144
|
+
__typename: 'OsceMarksheetMark',
|
|
145
|
+
}),
|
|
146
|
+
fragment: (0, client_1.gql) `
|
|
147
|
+
fragment OsceMarksheetMarkForScore on OsceMarksheetMark {
|
|
148
|
+
osceMarksheetId
|
|
149
|
+
}
|
|
150
|
+
`,
|
|
151
|
+
});
|
|
152
|
+
if (!markEntity?.osceMarksheetId) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const marksheetId = markEntity.osceMarksheetId;
|
|
156
|
+
const marksheet = cache.readFragment({
|
|
157
|
+
id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
|
|
158
|
+
fragment: (0, client_1.gql) `
|
|
159
|
+
fragment OsceMarksheetMarksForScore on OsceMarksheet {
|
|
160
|
+
marks {
|
|
161
|
+
mark
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
});
|
|
166
|
+
if (!marksheet?.marks?.length) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const total = marksheet.marks.length;
|
|
170
|
+
const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
|
|
171
|
+
cache.modify({
|
|
172
|
+
id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
|
|
173
|
+
fields: {
|
|
174
|
+
score: () => scored / total,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
exports.updateCacheOnMarkOsceMarksheetMark = updateCacheOnMarkOsceMarksheetMark;
|
|
121
179
|
exports.SELECT_OSCE_STATION = (0, client_1.gql) `
|
|
122
180
|
${fragments_1.OSCE_STATION_FIELDS}
|
|
123
181
|
${fragments_1.OSCE_MARKSHEET_FIELDS}
|
|
@@ -45,9 +45,11 @@ export declare const MARK_OSCE_MARKSHEET_MARK: import("@apollo/client").Document
|
|
|
45
45
|
export interface IMarkOsceMarksheetMarkVar {
|
|
46
46
|
osceMarksheetMarkId: Id;
|
|
47
47
|
mark: number | EPaceMarkType;
|
|
48
|
+
corrected?: Boolean;
|
|
48
49
|
}
|
|
49
50
|
export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
|
|
50
51
|
export declare const optimisticMarkOsceMarksheetMark: (variables: IMarkOsceMarksheetMarkVar, productType: EProductType) => IMarkOsceMarksheetMarkData;
|
|
52
|
+
export declare const updateCacheOnMarkOsceMarksheetMark: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IMarkOsceMarksheetMarkData>, options: ApolloUpdateOptions<IMarkOsceMarksheetMarkVar>) => void;
|
|
51
53
|
export declare const SELECT_OSCE_STATION: import("@apollo/client").DocumentNode;
|
|
52
54
|
export interface ISelectOsceMarksheetStationVar {
|
|
53
55
|
osceMarksheetId: Id;
|
|
@@ -81,11 +81,12 @@ export const CHANGE_OSCE_ROLE = gql `
|
|
|
81
81
|
}
|
|
82
82
|
`;
|
|
83
83
|
export const MARK_OSCE_MARKSHEET_MARK = gql `
|
|
84
|
-
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int
|
|
84
|
+
mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $corrected: Boolean) {
|
|
85
85
|
restricted {
|
|
86
86
|
markOsceMarksheetMark(
|
|
87
87
|
osceMarksheetMarkId: $osceMarksheetMarkId
|
|
88
88
|
mark: $mark
|
|
89
|
+
corrected: $corrected
|
|
89
90
|
) {
|
|
90
91
|
id
|
|
91
92
|
selectedChoice
|
|
@@ -114,6 +115,62 @@ export const optimisticMarkOsceMarksheetMark = (variables, productType) => {
|
|
|
114
115
|
},
|
|
115
116
|
};
|
|
116
117
|
};
|
|
118
|
+
export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
|
|
119
|
+
const { markOsceMarksheetMark } = result?.data?.restricted || {};
|
|
120
|
+
const { variables } = options || {};
|
|
121
|
+
if (!variables || !markOsceMarksheetMark) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
cache.modify({
|
|
125
|
+
id: cache.identify({
|
|
126
|
+
id: variables.osceMarksheetMarkId,
|
|
127
|
+
__typename: 'OsceMarksheetMark',
|
|
128
|
+
}),
|
|
129
|
+
fields: {
|
|
130
|
+
selectedChoice: () => markOsceMarksheetMark.selectedChoice,
|
|
131
|
+
mark: () => markOsceMarksheetMark.mark,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
if (!variables.corrected) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const markEntity = cache.readFragment({
|
|
138
|
+
id: cache.identify({
|
|
139
|
+
id: variables.osceMarksheetMarkId,
|
|
140
|
+
__typename: 'OsceMarksheetMark',
|
|
141
|
+
}),
|
|
142
|
+
fragment: gql `
|
|
143
|
+
fragment OsceMarksheetMarkForScore on OsceMarksheetMark {
|
|
144
|
+
osceMarksheetId
|
|
145
|
+
}
|
|
146
|
+
`,
|
|
147
|
+
});
|
|
148
|
+
if (!markEntity?.osceMarksheetId) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const marksheetId = markEntity.osceMarksheetId;
|
|
152
|
+
const marksheet = cache.readFragment({
|
|
153
|
+
id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
|
|
154
|
+
fragment: gql `
|
|
155
|
+
fragment OsceMarksheetMarksForScore on OsceMarksheet {
|
|
156
|
+
marks {
|
|
157
|
+
mark
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`,
|
|
161
|
+
});
|
|
162
|
+
if (!marksheet?.marks?.length) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const total = marksheet.marks.length;
|
|
166
|
+
const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
|
|
167
|
+
cache.modify({
|
|
168
|
+
id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
|
|
169
|
+
fields: {
|
|
170
|
+
score: () => scored / total,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
};
|
|
117
174
|
export const SELECT_OSCE_STATION = gql `
|
|
118
175
|
${OSCE_STATION_FIELDS}
|
|
119
176
|
${OSCE_MARKSHEET_FIELDS}
|