Skip to content

Commit f4bd147

Browse files
[lets-see-how-deep-the-rabbit-hole-goes] A quick PR for testing the matrix widget upstream, as we want to try to recreate a nebulous bug
<see below>
1 parent 897eacc commit f4bd147

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

packages/perseus-score/src/widgets/matrix/validate-matrix.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import type {
1818
function validateMatrix(userInput: PerseusMatrixUserInput): ValidationResult {
1919
const supplied = userInput.answers;
2020
const suppliedSize = getMatrixSize(supplied);
21-
21+
// eslint-disable-next-line no-console
22+
console.log("suppliedSize", suppliedSize);
23+
// eslint-disable-next-line no-console
24+
console.log("supplied", supplied);
2225
for (let row = 0; row < suppliedSize[0]; row++) {
2326
for (let col = 0; col < suppliedSize[1]; col++) {
2427
if (

packages/perseus/src/widgets/matrix/matrix.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ class Matrix extends React.Component<Props, State> implements Widget {
151151
inputPaths.push(inputPath);
152152
}
153153
}
154-
154+
// eslint-disable-next-line no-console
155+
console.log("inputPaths", inputPaths);
155156
return inputPaths;
156157
};
157158

@@ -301,13 +302,17 @@ class Matrix extends React.Component<Props, State> implements Widget {
301302
cb,
302303
);
303304
this.props.trackInteraction();
305+
// eslint-disable-next-line no-console
306+
console.log("onValueChange", answers);
304307
};
305308

306309
/**
307310
* TODO: remove this when everything is pulling from Renderer state
308311
* @deprecated get user input from Renderer state
309312
*/
310313
getUserInput(): PerseusMatrixUserInput {
314+
// eslint-disable-next-line no-console
315+
console.log("getUserInput", this.props.userInput);
311316
return this.props.userInput;
312317
}
313318

@@ -321,10 +326,13 @@ class Matrix extends React.Component<Props, State> implements Widget {
321326
*/
322327
getSerializedState(): any {
323328
const {userInput, ...rest} = this.props;
324-
return {
329+
const serializedState = {
325330
...rest,
326331
answers: userInput.answers,
327332
};
333+
// eslint-disable-next-line no-console
334+
console.log("serializedState", serializedState);
335+
return serializedState;
328336
}
329337

330338
render(): React.ReactNode {
@@ -563,13 +571,15 @@ function getCorrectUserInput(
563571
function getUserInputFromSerializedState(
564572
serializedState: any,
565573
): PerseusMatrixUserInput {
574+
// eslint-disable-next-line no-console
575+
console.log("getUserInputFromSerializedState", serializedState);
566576
return {answers: serializedState.answers};
567577
}
568578

569579
export default {
570580
name: "matrix",
571581
displayName: "Matrix",
572-
hidden: true,
582+
hidden: false,
573583
widget: Matrix,
574584
transform,
575585
staticTransform: transform,

0 commit comments

Comments
 (0)