@quesmed/types-rn 2.2.100 → 2.2.101
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/package.json
CHANGED
|
@@ -51,7 +51,7 @@ export interface IMarksheetInput {
|
|
|
51
51
|
*/
|
|
52
52
|
export declare const SAVE_MARKSHEET: import("@apollo/client").DocumentNode;
|
|
53
53
|
export declare const updateMarksheets: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ISaveMarksheetsData>, options: ApolloUpdateOptions) => void;
|
|
54
|
-
export declare const optimisticSaveMarksheets: (
|
|
54
|
+
export declare const optimisticSaveMarksheets: (marksheet: IMarksheet, marksheetInput: IMarksheetInput, questionIndex: number) => ISaveMarksheetsData;
|
|
55
55
|
export interface ISaveMarksheetsVar {
|
|
56
56
|
marksheetInput: IMarksheetInput[];
|
|
57
57
|
}
|
|
@@ -1781,36 +1781,24 @@ const updateMarksheets = (cache, result, options) => {
|
|
|
1781
1781
|
}
|
|
1782
1782
|
};
|
|
1783
1783
|
exports.updateMarksheets = updateMarksheets;
|
|
1784
|
-
const optimisticSaveMarksheets = (
|
|
1784
|
+
const optimisticSaveMarksheets = (marksheet, marksheetInput, questionIndex) => {
|
|
1785
1785
|
const { timeTaken, choiceId, mark, marksheetId } = marksheetInput;
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
};
|
|
1800
|
-
const udatedMarks = [
|
|
1801
|
-
...marks.slice(0, questionIndex),
|
|
1802
|
-
updatedMark,
|
|
1803
|
-
...marks.slice(questionIndex + 1),
|
|
1804
|
-
];
|
|
1805
|
-
return {
|
|
1806
|
-
restricted: {
|
|
1807
|
-
saveMarksheets: [{ ...rest, marks: udatedMarks }],
|
|
1808
|
-
},
|
|
1809
|
-
};
|
|
1810
|
-
}
|
|
1786
|
+
const { marks = [], ...rest } = marksheet || {};
|
|
1787
|
+
const updatedMark = {
|
|
1788
|
+
...marks[questionIndex],
|
|
1789
|
+
marksheetId,
|
|
1790
|
+
timeTaken,
|
|
1791
|
+
questionChoiceId: choiceId ?? null,
|
|
1792
|
+
mark: mark || null,
|
|
1793
|
+
};
|
|
1794
|
+
const udatedMarks = [
|
|
1795
|
+
...marks.slice(0, questionIndex),
|
|
1796
|
+
updatedMark,
|
|
1797
|
+
...marks.slice(questionIndex + 1),
|
|
1798
|
+
];
|
|
1811
1799
|
return {
|
|
1812
1800
|
restricted: {
|
|
1813
|
-
saveMarksheets: [],
|
|
1801
|
+
saveMarksheets: [{ ...rest, marks: udatedMarks }],
|
|
1814
1802
|
},
|
|
1815
1803
|
};
|
|
1816
1804
|
};
|