@quesmed/types 2.6.268 → 2.6.270

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.
@@ -26,6 +26,8 @@ export interface IOsceMarksheetMark {
26
26
  osceMarksheet?: IOsceMarksheet;
27
27
  osceStationMarkId: Id;
28
28
  osceStationMark?: IOsceStationMark;
29
+ secondaryMark: number | null;
30
+ score: number | null;
29
31
  }
30
32
  export declare enum EOsceRoles {
31
33
  ALL = 0,
@@ -63,7 +65,8 @@ export declare enum EOsceMarksheetMode {
63
65
  }
64
66
  export declare enum EOsceStationPhase {
65
67
  PATIENT = "PATIENT",
66
- EXAMINER = "EXAMINER"
68
+ EXAMINER = "EXAMINER",
69
+ EXAMINATION = "EXAMINATION"
67
70
  }
68
71
  export interface IOsceMarksheetMessage {
69
72
  id: Id;
@@ -44,6 +44,7 @@ var EOsceStationPhase;
44
44
  (function (EOsceStationPhase) {
45
45
  EOsceStationPhase["PATIENT"] = "PATIENT";
46
46
  EOsceStationPhase["EXAMINER"] = "EXAMINER";
47
+ EOsceStationPhase["EXAMINATION"] = "EXAMINATION";
47
48
  })(EOsceStationPhase = exports.EOsceStationPhase || (exports.EOsceStationPhase = {}));
48
49
  var EOsceTimerState;
49
50
  (function (EOsceTimerState) {
@@ -100,6 +100,8 @@ exports.OSCE_MARKSHEET_MARK_FIELDS = (0, client_1.gql) `
100
100
  id
101
101
  index
102
102
  mark
103
+ score
104
+ secondaryMark
103
105
  selectedChoice
104
106
  osceMarksheetId
105
107
  osceStationMarkId
@@ -45,6 +45,7 @@ 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
+ secondaryMark?: number;
48
49
  corrected?: Boolean;
49
50
  }
50
51
  export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
@@ -84,16 +84,19 @@ 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!, $corrected: Boolean) {
87
+ mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $secondaryMark: Int, $corrected: Boolean) {
88
88
  restricted {
89
89
  markOsceMarksheetMark(
90
90
  osceMarksheetMarkId: $osceMarksheetMarkId
91
91
  mark: $mark
92
+ secondaryMark: $secondaryMark
92
93
  corrected: $corrected
93
94
  ) {
94
95
  id
95
96
  selectedChoice
96
97
  mark
98
+ score
99
+ secondaryMark
97
100
  }
98
101
  }
99
102
  }
@@ -103,10 +106,13 @@ const optimisticMarkOsceMarksheetMark = (variables, productType) => {
103
106
  if (productType === models_1.EProductType.PACES) {
104
107
  data.selectedChoice = variables.mark;
105
108
  data.mark = null;
109
+ data.secondaryMark = variables.secondaryMark;
110
+ data.score = null;
106
111
  }
107
112
  else {
108
113
  data.mark = variables.mark;
109
114
  data.selectedChoice = null;
115
+ data.score = variables.mark;
110
116
  }
111
117
  return {
112
118
  restricted: {
@@ -133,6 +139,8 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
133
139
  fields: {
134
140
  selectedChoice: () => markOsceMarksheetMark.selectedChoice,
135
141
  mark: () => markOsceMarksheetMark.mark,
142
+ secondaryMark: () => markOsceMarksheetMark.secondaryMark,
143
+ score: () => markOsceMarksheetMark.score,
136
144
  },
137
145
  });
138
146
  if (!variables.corrected) {
@@ -159,6 +167,8 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
159
167
  fragment OsceMarksheetMarksForScore on OsceMarksheet {
160
168
  marks {
161
169
  mark
170
+ score
171
+ secondaryMark
162
172
  }
163
173
  }
164
174
  `,
@@ -166,12 +176,14 @@ const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
166
176
  if (!marksheet?.marks?.length) {
167
177
  return;
168
178
  }
169
- const total = marksheet.marks.length;
170
- const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
179
+ const hasSecondaryMarks = marksheet.marks.some((m) => m.secondaryMark);
180
+ const total = hasSecondaryMarks ? 2 * marksheet.marks.length : marksheet.marks.length;
181
+ // const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
182
+ const userScore = marksheet.marks.reduce((sum, m) => sum + Number(m.score), 0);
171
183
  cache.modify({
172
184
  id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
173
185
  fields: {
174
- score: () => scored / total,
186
+ score: () => userScore / total,
175
187
  },
176
188
  });
177
189
  };
@@ -26,6 +26,8 @@ export interface IOsceMarksheetMark {
26
26
  osceMarksheet?: IOsceMarksheet;
27
27
  osceStationMarkId: Id;
28
28
  osceStationMark?: IOsceStationMark;
29
+ secondaryMark: number | null;
30
+ score: number | null;
29
31
  }
30
32
  export declare enum EOsceRoles {
31
33
  ALL = 0,
@@ -63,7 +65,8 @@ export declare enum EOsceMarksheetMode {
63
65
  }
64
66
  export declare enum EOsceStationPhase {
65
67
  PATIENT = "PATIENT",
66
- EXAMINER = "EXAMINER"
68
+ EXAMINER = "EXAMINER",
69
+ EXAMINATION = "EXAMINATION"
67
70
  }
68
71
  export interface IOsceMarksheetMessage {
69
72
  id: Id;
@@ -41,6 +41,7 @@ export var EOsceStationPhase;
41
41
  (function (EOsceStationPhase) {
42
42
  EOsceStationPhase["PATIENT"] = "PATIENT";
43
43
  EOsceStationPhase["EXAMINER"] = "EXAMINER";
44
+ EOsceStationPhase["EXAMINATION"] = "EXAMINATION";
44
45
  })(EOsceStationPhase || (EOsceStationPhase = {}));
45
46
  export var EOsceTimerState;
46
47
  (function (EOsceTimerState) {
@@ -97,6 +97,8 @@ export const OSCE_MARKSHEET_MARK_FIELDS = gql `
97
97
  id
98
98
  index
99
99
  mark
100
+ score
101
+ secondaryMark
100
102
  selectedChoice
101
103
  osceMarksheetId
102
104
  osceStationMarkId
@@ -45,6 +45,7 @@ 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
+ secondaryMark?: number;
48
49
  corrected?: Boolean;
49
50
  }
50
51
  export type IMarkOsceMarksheetMarkData = RestrictedData<graphqlNormalize & Partial<IOsceMarksheetMark>, 'markOsceMarksheetMark'>;
@@ -81,16 +81,19 @@ 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!, $corrected: Boolean) {
84
+ mutation MarkOsceMarksheetMark($osceMarksheetMarkId: Int!, $mark: Int!, $secondaryMark: Int, $corrected: Boolean) {
85
85
  restricted {
86
86
  markOsceMarksheetMark(
87
87
  osceMarksheetMarkId: $osceMarksheetMarkId
88
88
  mark: $mark
89
+ secondaryMark: $secondaryMark
89
90
  corrected: $corrected
90
91
  ) {
91
92
  id
92
93
  selectedChoice
93
94
  mark
95
+ score
96
+ secondaryMark
94
97
  }
95
98
  }
96
99
  }
@@ -100,10 +103,13 @@ export const optimisticMarkOsceMarksheetMark = (variables, productType) => {
100
103
  if (productType === EProductType.PACES) {
101
104
  data.selectedChoice = variables.mark;
102
105
  data.mark = null;
106
+ data.secondaryMark = variables.secondaryMark;
107
+ data.score = null;
103
108
  }
104
109
  else {
105
110
  data.mark = variables.mark;
106
111
  data.selectedChoice = null;
112
+ data.score = variables.mark;
107
113
  }
108
114
  return {
109
115
  restricted: {
@@ -129,6 +135,8 @@ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
129
135
  fields: {
130
136
  selectedChoice: () => markOsceMarksheetMark.selectedChoice,
131
137
  mark: () => markOsceMarksheetMark.mark,
138
+ secondaryMark: () => markOsceMarksheetMark.secondaryMark,
139
+ score: () => markOsceMarksheetMark.score,
132
140
  },
133
141
  });
134
142
  if (!variables.corrected) {
@@ -155,6 +163,8 @@ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
155
163
  fragment OsceMarksheetMarksForScore on OsceMarksheet {
156
164
  marks {
157
165
  mark
166
+ score
167
+ secondaryMark
158
168
  }
159
169
  }
160
170
  `,
@@ -162,12 +172,14 @@ export const updateCacheOnMarkOsceMarksheetMark = (cache, result, options) => {
162
172
  if (!marksheet?.marks?.length) {
163
173
  return;
164
174
  }
165
- const total = marksheet.marks.length;
166
- const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
175
+ const hasSecondaryMarks = marksheet.marks.some((m) => m.secondaryMark);
176
+ const total = hasSecondaryMarks ? 2 * marksheet.marks.length : marksheet.marks.length;
177
+ // const scored = marksheet.marks.filter(({ mark }) => Boolean(mark)).length;
178
+ const userScore = marksheet.marks.reduce((sum, m) => sum + Number(m.score), 0);
167
179
  cache.modify({
168
180
  id: cache.identify({ id: marksheetId, __typename: 'OsceMarksheet' }),
169
181
  fields: {
170
- score: () => scored / total,
182
+ score: () => userScore / total,
171
183
  },
172
184
  });
173
185
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.268",
3
+ "version": "2.6.270",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",