@quesmed/types-rn 2.6.268 → 2.6.269

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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.268",
3
+ "version": "2.6.269",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -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
  };