Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a913d43df | |||
| b6a7131b9a |
@@ -1,16 +1,6 @@
|
|||||||
{
|
{
|
||||||
"functions": {
|
"functions": {
|
||||||
"source": "functions",
|
"source": "functions"
|
||||||
"ignore": [
|
|
||||||
"node_modules",
|
|
||||||
".git",
|
|
||||||
"firebase-debug.log",
|
|
||||||
"firebase-debug.*.log",
|
|
||||||
"**/_private_stuff/**"
|
|
||||||
],
|
|
||||||
"predeploy": [
|
|
||||||
"npm --prefix \"$RESOURCE_DIR\" run lint"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"firestore": {
|
"firestore": {
|
||||||
"rules": "firestore.rules",
|
"rules": "firestore.rules",
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
/* eslint-disable no-tabs */
|
/* eslint-disable no-tabs */
|
||||||
const levenshtein = require('js-levenshtein');
|
const levenshtein = require('js-levenshtein');
|
||||||
const functions = require("firebase-functions").region("europe-west2");//.region("europe-west2")
|
const functions = require("firebase-functions");//.region("europe-west2")
|
||||||
const admin = require("firebase-admin");
|
const admin = require("firebase-admin");
|
||||||
admin.initializeApp();
|
admin.initializeApp();
|
||||||
const db = admin.firestore();
|
const db = admin.firestore();
|
||||||
|
|
||||||
const LOCAL_TESTING = false;
|
const LOCAL_TESTING = false;
|
||||||
const TESTING_USER_ID = "IjQBy5MmTPyOaZY0heexwb5bdKzG" //"M3JPrFRH6Fdo8XMUbF0l2zVZUCH3"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Randomises the items in an array.
|
* Randomises the items in an array.
|
||||||
@@ -67,7 +66,7 @@ exports.userDeleted = functions.auth.user().onDelete((user) => {
|
|||||||
* NOTE: can't be unit tested
|
* NOTE: can't be unit tested
|
||||||
*/
|
*/
|
||||||
exports.getGroupMembers = functions.https.onCall((data, context) => {
|
exports.getGroupMembers = functions.https.onCall((data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -141,7 +140,6 @@ exports.getGroupMembers = functions.https.onCall((data, context) => {
|
|||||||
/**
|
/**
|
||||||
* Creates new progress document.
|
* Creates new progress document.
|
||||||
* @param {object} data The data passed to the function.
|
* @param {object} data The data passed to the function.
|
||||||
* @param {boolean} data.ignoreAccents Whether accents on letters should matter during the test. Optional.
|
|
||||||
* @param {boolean} data.ignoreCaps Whether capitalisation of answers should matter during the test. Optional.
|
* @param {boolean} data.ignoreCaps Whether capitalisation of answers should matter during the test. Optional.
|
||||||
* @param {boolean} data.limit The maximum number of lives/questions for the test.
|
* @param {boolean} data.limit The maximum number of lives/questions for the test.
|
||||||
* @param {boolean} data.mode The mode to be tested in. Valid options are "questions" and "lives".
|
* @param {boolean} data.mode The mode to be tested in. Valid options are "questions" and "lives".
|
||||||
@@ -152,7 +150,7 @@ exports.getGroupMembers = functions.https.onCall((data, context) => {
|
|||||||
* @return {string} The ID of the created progress document.
|
* @return {string} The ID of the created progress document.
|
||||||
*/
|
*/
|
||||||
exports.createProgress = functions.https.onCall((data, context) => {
|
exports.createProgress = functions.https.onCall((data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
"failed-precondition",
|
"failed-precondition",
|
||||||
@@ -175,14 +173,7 @@ exports.createProgress = functions.https.onCall((data, context) => {
|
|||||||
data.ignoreCaps = false;
|
data.ignoreCaps = false;
|
||||||
console.log("ignoreCaps not provided - using default value of false");
|
console.log("ignoreCaps not provided - using default value of false");
|
||||||
} else if (typeof data.ignoreCaps !== "boolean") {
|
} else if (typeof data.ignoreCaps !== "boolean") {
|
||||||
throw new functions.https.HttpsError("invalid-argument", "ignoreCaps must be a boolean");
|
throw new functions.https.HttpsError("invalid-argument", "showNumberOfAnswers must be a boolean");
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof data.ignoreAccents === "undefined") {
|
|
||||||
data.ignoreAccents = false;
|
|
||||||
console.log("ignoreAccents not provided - using default value of false");
|
|
||||||
} else if (typeof data.ignoreAccents !== "boolean") {
|
|
||||||
throw new functions.https.HttpsError("invalid-argument", "ignoreAccents must be a boolean");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data.showNumberOfAnswers === "undefined") {
|
if (typeof data.showNumberOfAnswers === "undefined") {
|
||||||
@@ -264,7 +255,6 @@ exports.createProgress = functions.https.onCall((data, context) => {
|
|||||||
set_titles: setIds.map((setId) => setTitlesDict[setId]),
|
set_titles: setIds.map((setId) => setTitlesDict[setId]),
|
||||||
typo: false,
|
typo: false,
|
||||||
ignoreCaps: data.ignoreCaps,
|
ignoreCaps: data.ignoreCaps,
|
||||||
ignoreAccents: data.ignoreAccents,
|
|
||||||
showNumberOfAnswers: data.showNumberOfAnswers,
|
showNumberOfAnswers: data.showNumberOfAnswers,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +328,7 @@ exports.createProgress = functions.https.onCall((data, context) => {
|
|||||||
* @return {string} The ID of the created progress document.
|
* @return {string} The ID of the created progress document.
|
||||||
*/
|
*/
|
||||||
exports.createProgressWithIncorrect = functions.https.onCall((data, context) => {
|
exports.createProgressWithIncorrect = functions.https.onCall((data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -429,10 +419,9 @@ exports.createProgressWithIncorrect = functions.https.onCall((data, context) =>
|
|||||||
* @param {string} item The term/definition to remove the characters that should be ignored from.
|
* @param {string} item The term/definition to remove the characters that should be ignored from.
|
||||||
* @return {string} The original string with the unwanted characters removed.
|
* @return {string} The original string with the unwanted characters removed.
|
||||||
*/
|
*/
|
||||||
function cleanseVocabString(item, ignoreCaps=false, ignoreAccents=false) {
|
function cleanseVocabString(item, ignoreCaps=false) {
|
||||||
const chars = /[\p{P}\p{S}\n ]+/ug;
|
const chars = /[\p{P}\p{S} ]+/ug;
|
||||||
let cleansed = item.replace(chars, "");
|
const cleansed = item.replace(chars, "");
|
||||||
if (ignoreAccents) cleansed = cleansed.normalize('NFD').replace(/\p{Diacritic}/gu, "");
|
|
||||||
if (ignoreCaps) {
|
if (ignoreCaps) {
|
||||||
return cleansed.toLowerCase();
|
return cleansed.toLowerCase();
|
||||||
} else {
|
} else {
|
||||||
@@ -468,7 +457,7 @@ function cleanseVocabString(item, ignoreCaps=false, ignoreAccents=false) {
|
|||||||
* @return {boolean} typo Whether the inputted answer is likely to include a typo (using Levenshtein distance or by detecting a null answer).
|
* @return {boolean} typo Whether the inputted answer is likely to include a typo (using Levenshtein distance or by detecting a null answer).
|
||||||
*/
|
*/
|
||||||
exports.processAnswer = functions.https.onCall((data, context) => {
|
exports.processAnswer = functions.https.onCall((data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
@@ -504,8 +493,6 @@ exports.processAnswer = functions.https.onCall((data, context) => {
|
|||||||
|
|
||||||
return transaction.get(progressDoc.data().switch_language ? termDocId : definitionDocId).then((answerDoc) => {
|
return transaction.get(progressDoc.data().switch_language ? termDocId : definitionDocId).then((answerDoc) => {
|
||||||
const docData = progressDoc.data();
|
const docData = progressDoc.data();
|
||||||
docData.ignoreCaps = docData.ignoreCaps === true;
|
|
||||||
docData.ignoreAccents = docData.ignoreAccents === true;
|
|
||||||
const mode = docData.mode;
|
const mode = docData.mode;
|
||||||
const correctAnswers = answerDoc.data().item;
|
const correctAnswers = answerDoc.data().item;
|
||||||
const splitCorrectAnswers = correctAnswers.split("/");
|
const splitCorrectAnswers = correctAnswers.split("/");
|
||||||
@@ -519,16 +506,15 @@ exports.processAnswer = functions.https.onCall((data, context) => {
|
|||||||
cleansedDoneSplitCorrectAnswers.push(
|
cleansedDoneSplitCorrectAnswers.push(
|
||||||
cleanseVocabString(
|
cleanseVocabString(
|
||||||
notDoneSplitCorrectAnswers.splice(index, 1)[0],
|
notDoneSplitCorrectAnswers.splice(index, 1)[0],
|
||||||
docData.ignoreCaps,
|
docData.ignoreCaps
|
||||||
docData.ignoreAccents
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const cleansedNotDoneSplitCorrectAnswers = notDoneSplitCorrectAnswers.map((answer) => cleanseVocabString(answer, docData.ignoreCaps, docData.ignoreAccents));
|
const cleansedNotDoneSplitCorrectAnswers = notDoneSplitCorrectAnswers.map((answer) => cleanseVocabString(answer, docData.ignoreCaps));
|
||||||
|
|
||||||
const cleansedSplitCorrectAnswers = cleansedNotDoneSplitCorrectAnswers.concat(cleansedDoneSplitCorrectAnswers);
|
const cleansedSplitCorrectAnswers = cleansedNotDoneSplitCorrectAnswers.concat(cleansedDoneSplitCorrectAnswers);
|
||||||
const cleansedInputAnswer = cleanseVocabString(inputAnswer, docData.ignoreCaps, docData.ignoreAccents);
|
const cleansedInputAnswer = cleanseVocabString(inputAnswer, docData.ignoreCaps);
|
||||||
|
|
||||||
let isCorrectAnswer = false;
|
let isCorrectAnswer = false;
|
||||||
let correctAnswerIndex;
|
let correctAnswerIndex;
|
||||||
@@ -769,7 +755,7 @@ exports.processAnswer = functions.https.onCall((data, context) => {
|
|||||||
* @return {promise} The promise from setting the target user's admin custom auth claim.
|
* @return {promise} The promise from setting the target user's admin custom auth claim.
|
||||||
*/
|
*/
|
||||||
exports.setAdmin = functions.https.onCall(async (data, context) => {
|
exports.setAdmin = functions.https.onCall(async (data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
const isAdmin = LOCAL_TESTING ? true : context.auth.token.admin;
|
const isAdmin = LOCAL_TESTING ? true : context.auth.token.admin;
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
@@ -802,7 +788,7 @@ exports.setAdmin = functions.https.onCall(async (data, context) => {
|
|||||||
* @return {boolean} true, to show the function has succeeded.
|
* @return {boolean} true, to show the function has succeeded.
|
||||||
*/
|
*/
|
||||||
exports.addSetToGroup = functions.https.onCall((data, context) => {
|
exports.addSetToGroup = functions.https.onCall((data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
const isAdmin = LOCAL_TESTING ? false : context.auth.token.admin;
|
const isAdmin = LOCAL_TESTING ? false : context.auth.token.admin;
|
||||||
const auth = LOCAL_TESTING ? { uid: uid } : context.auth;
|
const auth = LOCAL_TESTING ? { uid: uid } : context.auth;
|
||||||
|
|
||||||
@@ -871,7 +857,7 @@ exports.addSetToGroup = functions.https.onCall((data, context) => {
|
|||||||
* @return {promise} The promise from setting the group's updated data.
|
* @return {promise} The promise from setting the group's updated data.
|
||||||
*/
|
*/
|
||||||
exports.removeSetFromGroup = functions.https.onCall((data, context) => {
|
exports.removeSetFromGroup = functions.https.onCall((data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
const isAdmin = LOCAL_TESTING ? false : context.auth.token.admin;
|
const isAdmin = LOCAL_TESTING ? false : context.auth.token.admin;
|
||||||
const auth = LOCAL_TESTING ? { uid: uid } : context.auth;
|
const auth = LOCAL_TESTING ? { uid: uid } : context.auth;
|
||||||
|
|
||||||
@@ -1010,7 +996,7 @@ async function generateJoinCode() {
|
|||||||
* @return {string} The ID of the new group's document in the groups collection.
|
* @return {string} The ID of the new group's document in the groups collection.
|
||||||
*/
|
*/
|
||||||
exports.createGroup = functions.https.onCall(async (data, context) => {
|
exports.createGroup = functions.https.onCall(async (data, context) => {
|
||||||
const uid = LOCAL_TESTING ? TESTING_USER_ID : context.auth.uid;
|
const uid = LOCAL_TESTING ? "M3JPrFRH6Fdo8XMUbF0l2zVZUCH3" : context.auth.uid;
|
||||||
|
|
||||||
if (context.app == undefined && !LOCAL_TESTING) {
|
if (context.app == undefined && !LOCAL_TESTING) {
|
||||||
throw new functions.https.HttpsError(
|
throw new functions.https.HttpsError(
|
||||||
|
|||||||
3710
functions/package-lock.json
generated
3710
functions/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
51327
package-lock.json
generated
51327
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "parandum",
|
"name": "parandum",
|
||||||
"version": "2.3.4",
|
"version": "2.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.16.0",
|
"@babel/core": "^7.16.0",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"firebase": "^8.10.0",
|
"firebase": "^8.10.0",
|
||||||
"firebase-admin": "^9.12.0",
|
"firebase-admin": "^9.12.0",
|
||||||
"firebase-functions": "^3.16.0",
|
"firebase-functions": "^3.16.0",
|
||||||
"firebase-tools": "^11.16.1",
|
"firebase-tools": "^9.23.0",
|
||||||
"firebaseui": "^5.0.0",
|
"firebaseui": "^5.0.0",
|
||||||
"normalize-url": "^6.1.0",
|
"normalize-url": "^6.1.0",
|
||||||
"rc-slider": "^9.7.4",
|
"rc-slider": "^9.7.4",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-firebaseui": "^5.0.2",
|
"react-firebaseui": "^5.0.2",
|
||||||
"react-router-dom": "^5.3.0",
|
"react-router-dom": "^5.3.0",
|
||||||
"react-scripts": "^5.0.1",
|
"react-scripts": "^5.0.0-next.47",
|
||||||
"react-select": "^5.2.1",
|
"react-select": "^5.2.1",
|
||||||
"react-simple-keyboard": "^3.4.65",
|
"react-simple-keyboard": "^3.4.65",
|
||||||
"react-xarrows": "^2.0.2",
|
"react-xarrows": "^2.0.2",
|
||||||
@@ -75,10 +75,8 @@
|
|||||||
"@firebase/rules-unit-testing": "^1.3.12",
|
"@firebase/rules-unit-testing": "^1.3.12",
|
||||||
"@testing-library/react": "^11.2.7",
|
"@testing-library/react": "^11.2.7",
|
||||||
"@testing-library/user-event": "^12.8.3",
|
"@testing-library/user-event": "^12.8.3",
|
||||||
"create-react-app": "^5.0.1",
|
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-config-google": "^0.14.0",
|
"eslint-config-google": "^0.14.0",
|
||||||
"eslint-config-react-app": "^6.0.0",
|
|
||||||
"eslint-plugin-promise": "^5.1.1",
|
"eslint-plugin-promise": "^5.1.1",
|
||||||
"firebase-functions-test": "^0.3.3",
|
"firebase-functions-test": "^0.3.3",
|
||||||
"hamjest": "^3.7.3",
|
"hamjest": "^3.7.3",
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import Button from './Button';
|
|
||||||
|
|
||||||
export default function ConfirmationDialog(props) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="overlay" onClick={props.acceptFunction}></div>
|
|
||||||
<div className="overlay-content confirmation-dialog accept-dialog">
|
|
||||||
<h3>{props.message}</h3>
|
|
||||||
<div className="button-container button-container--center">
|
|
||||||
<Button
|
|
||||||
onClick={props.acceptFunction}
|
|
||||||
>
|
|
||||||
Ok
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
60
src/App.js
60
src/App.js
@@ -12,7 +12,6 @@ import Settings from "./Settings";
|
|||||||
import Progress from "./Progress";
|
import Progress from "./Progress";
|
||||||
import UserSets from "./UserSets";
|
import UserSets from "./UserSets";
|
||||||
import EditSet from "./EditSet";
|
import EditSet from "./EditSet";
|
||||||
import BulkCreateSets from "./BulkCreateSets";
|
|
||||||
import Error404 from "./Error404";
|
import Error404 from "./Error404";
|
||||||
import History from "./History";
|
import History from "./History";
|
||||||
import MistakesHistory from "./MistakesHistory";
|
import MistakesHistory from "./MistakesHistory";
|
||||||
@@ -35,7 +34,6 @@ import "firebase/functions";
|
|||||||
import "firebase/app-check";
|
import "firebase/app-check";
|
||||||
import "firebase/firestore";
|
import "firebase/firestore";
|
||||||
import "firebase/analytics";
|
import "firebase/analytics";
|
||||||
import PlatformDisabled from './PlatformDisabled';
|
|
||||||
|
|
||||||
// TODO: app check debug token set in index.html - remove before deploy
|
// TODO: app check debug token set in index.html - remove before deploy
|
||||||
|
|
||||||
@@ -55,10 +53,10 @@ appCheck.activate(
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// firebase.functions().useEmulator("localhost", 5001);
|
firebase.functions().useEmulator("localhost", 5001);
|
||||||
// firebase.auth().useEmulator("http://localhost:9099");
|
firebase.auth().useEmulator("http://localhost:9099");
|
||||||
// firebase.firestore().useEmulator("localhost", 8080);
|
firebase.firestore().useEmulator("localhost", 8080);
|
||||||
const functions = firebase.app().functions("europe-west2");//firebase.functions();
|
const functions = firebase.functions();//firebase.app().functions("europe-west2");
|
||||||
|
|
||||||
const fadeIn = keyframes`
|
const fadeIn = keyframes`
|
||||||
from {
|
from {
|
||||||
@@ -193,6 +191,29 @@ class App extends React.Component {
|
|||||||
iterations: 1,
|
iterations: 1,
|
||||||
fill: "forwards",
|
fill: "forwards",
|
||||||
});
|
});
|
||||||
|
this.root.animate({
|
||||||
|
marginBottom: ["0px", `${this.cookieNoticeHeight}px`],
|
||||||
|
}, {
|
||||||
|
duration: 1000,
|
||||||
|
easing: "ease-in-out",
|
||||||
|
iterations: 1,
|
||||||
|
fill: "forwards",
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', this.updateCookieNoticeMargins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCookieNoticeMargins = () => {
|
||||||
|
if (this.cookieNoticeHeight !== this.cookieNotice.offsetHeight) {
|
||||||
|
this.cookieNoticeHeight = this.cookieNotice.offsetHeight;
|
||||||
|
this.root.animate({
|
||||||
|
marginBottom: [`${this.root.marginBottom}px`, `${this.cookieNoticeHeight}px`],
|
||||||
|
}, {
|
||||||
|
duration: 500,
|
||||||
|
easing: "ease-in-out",
|
||||||
|
iterations: 1,
|
||||||
|
fill: "forwards",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,6 +261,14 @@ class App extends React.Component {
|
|||||||
iterations: 1,
|
iterations: 1,
|
||||||
fill: "forwards",
|
fill: "forwards",
|
||||||
});
|
});
|
||||||
|
this.root.animate({
|
||||||
|
marginBottom: [`${this.cookieNoticeHeight}px`, "0px"],
|
||||||
|
}, {
|
||||||
|
duration: 1000,
|
||||||
|
easing: "ease-in-out",
|
||||||
|
iterations: 1,
|
||||||
|
fill: "forwards",
|
||||||
|
});
|
||||||
setTimeout(() => this.cookieNotice.style.display = "none", 1000);
|
setTimeout(() => this.cookieNotice.style.display = "none", 1000);
|
||||||
this.cookies.set("parandum-cookies-accepted", "true", {
|
this.cookies.set("parandum-cookies-accepted", "true", {
|
||||||
maxAge: 31556952,
|
maxAge: 31556952,
|
||||||
@@ -259,18 +288,6 @@ class App extends React.Component {
|
|||||||
?
|
?
|
||||||
<>
|
<>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/tos" exact>
|
|
||||||
<TermsOfService logEvent={analytics.logEvent} page={this.page} />
|
|
||||||
</Route>
|
|
||||||
<Route path="/privacy" exact>
|
|
||||||
<PrivacyPolicy logEvent={analytics.logEvent} page={this.page} />
|
|
||||||
</Route>
|
|
||||||
{
|
|
||||||
this.state.user.email.endsWith("@reading-school.co.uk") &&
|
|
||||||
<Route path="/">
|
|
||||||
<PlatformDisabled logEvent={analytics.logEvent} page={this.page} />
|
|
||||||
</Route>
|
|
||||||
}
|
|
||||||
<Route path="/" exact>
|
<Route path="/" exact>
|
||||||
<LoggedInHome db={db} firebase={firebase} functions={functions} user={this.state.user} logEvent={analytics.logEvent} page={this.page} />
|
<LoggedInHome db={db} firebase={firebase} functions={functions} user={this.state.user} logEvent={analytics.logEvent} page={this.page} />
|
||||||
</Route>
|
</Route>
|
||||||
@@ -298,13 +315,10 @@ class App extends React.Component {
|
|||||||
this.state.coloredEdges &&
|
this.state.coloredEdges &&
|
||||||
<div className="colored-edges"></div>
|
<div className="colored-edges"></div>
|
||||||
}
|
}
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/create-set" exact>
|
<Route path="/create-set" exact>
|
||||||
<EditSet db={db} user={this.state.user} logEvent={analytics.logEvent} page={this.page} createSet={true} />
|
<EditSet db={db} user={this.state.user} logEvent={analytics.logEvent} page={this.page} createSet={true} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/create-set/bulk" exact>
|
|
||||||
<BulkCreateSets db={db} user={this.state.user} logEvent={analytics.logEvent} page={this.page} />
|
|
||||||
</Route>
|
|
||||||
<Route path="/my-sets" exact>
|
<Route path="/my-sets" exact>
|
||||||
<UserSets db={db} functions={functions} user={this.state.user} logEvent={analytics.logEvent} page={this.page} />
|
<UserSets db={db} functions={functions} user={this.state.user} logEvent={analytics.logEvent} page={this.page} />
|
||||||
</Route>
|
</Route>
|
||||||
@@ -353,7 +367,7 @@ class App extends React.Component {
|
|||||||
}
|
}
|
||||||
<div className="cookie-notice" id="cookie-notice">
|
<div className="cookie-notice" id="cookie-notice">
|
||||||
<div>
|
<div>
|
||||||
<p>Just so you know, we use cookies. By using this site you consent to this. Read our privacy policy <Link to="/privacy">here</Link>.</p>
|
<p>Just so you know, we use cookies. Read our privacy policy <Link to="/privacy">here</Link>.</p>
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,394 +0,0 @@
|
|||||||
import React, { Component } from 'react';
|
|
||||||
import { withRouter, Prompt } from "react-router-dom";
|
|
||||||
import { HomeRounded as HomeRoundedIcon, UndoRounded as TuneRoundedIcon } from "@material-ui/icons";
|
|
||||||
import NavBar from "./NavBar";
|
|
||||||
import Button from "./Button";
|
|
||||||
import Footer from "./Footer";
|
|
||||||
import LinkButton from "./LinkButton";
|
|
||||||
import AcceptDialog from "./AcceptDialog";
|
|
||||||
import Checkbox from '@material-ui/core/Checkbox';
|
|
||||||
|
|
||||||
const emptySetData = {
|
|
||||||
title: "",
|
|
||||||
public: false,
|
|
||||||
text: "",
|
|
||||||
vocabPairs: [],
|
|
||||||
vocabChanged: false,
|
|
||||||
incompletePairFound: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withRouter(class BulkCreateSets extends Component {
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
user: props.user,
|
|
||||||
db: props.db,
|
|
||||||
loading: false,
|
|
||||||
canSave: false,
|
|
||||||
sets: [
|
|
||||||
{
|
|
||||||
...emptySetData
|
|
||||||
}
|
|
||||||
],
|
|
||||||
navbarItems: [
|
|
||||||
{
|
|
||||||
type: "link",
|
|
||||||
link: "/",
|
|
||||||
icon: <HomeRoundedIcon />,
|
|
||||||
hideTextMobile: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
termDefSeparator: "\\n",
|
|
||||||
pairSeparator: "\\n",
|
|
||||||
changesMade: false,
|
|
||||||
showErrorDialog: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let isMounted = true;
|
|
||||||
Object.defineProperty(this, "isMounted", {
|
|
||||||
get: () => isMounted,
|
|
||||||
set: (value) => isMounted = value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setState = (state, callback = null) => {
|
|
||||||
if (this.isMounted) super.setState(state, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
alertLeavingWithoutSaving = (e = null) => {
|
|
||||||
if (this.state.changesMade) {
|
|
||||||
var confirmationMessage = "Are you sure you want to leave? You will lose any unsaved changes.";
|
|
||||||
|
|
||||||
(e || window.event).returnValue = confirmationMessage; //Gecko + IE
|
|
||||||
return confirmationMessage; //Gecko + Webkit, Safari, Chrome etc.
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
async componentDidMount() {
|
|
||||||
window.addEventListener("beforeunload", this.alertLeavingWithoutSaving);
|
|
||||||
|
|
||||||
document.title = "Bulk Create Sets | Parandum";
|
|
||||||
this.props.logEvent("page_view");
|
|
||||||
|
|
||||||
this.firstSetNameInput.focus();
|
|
||||||
this.props.page.load();
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount = () => {
|
|
||||||
window.removeEventListener('beforeunload', this.alertLeavingWithoutSaving);
|
|
||||||
this.isMounted = false;
|
|
||||||
this.props.page.unload();
|
|
||||||
}
|
|
||||||
|
|
||||||
stopLoading = () => {
|
|
||||||
this.setState({
|
|
||||||
canSave: false,
|
|
||||||
loading: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanseVocabString = (item, otherPatterns=[]) => {
|
|
||||||
let newItem = item;
|
|
||||||
otherPatterns.map(pattern => newItem = newItem.replace(new RegExp(pattern, "g"), ""));
|
|
||||||
const chars = /[\p{P}\p{S}\n ]+/ug;
|
|
||||||
return newItem.replace(chars, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
removeNewLines = (item) => item.replace(/[\n]+/ug, "")
|
|
||||||
|
|
||||||
handleSetDataChange = () => {
|
|
||||||
const sets = [...this.state.sets];
|
|
||||||
if (sets[this.state.sets.length - 1].text !== "" || sets[this.state.sets.length - 1].title !== "") {
|
|
||||||
sets.push({...emptySetData});
|
|
||||||
this.setState({
|
|
||||||
sets,
|
|
||||||
changesMade: true,
|
|
||||||
});
|
|
||||||
} else if (sets[this.state.sets.length - 2].text === "" && sets[this.state.sets.length - 2].title === "") {
|
|
||||||
sets.pop();
|
|
||||||
this.setState({
|
|
||||||
sets,
|
|
||||||
changesMade: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkIfCanSave = async () => {
|
|
||||||
let anySetIncomplete = this.state.termDefSeparator === "" || this.state.pairSeparator === "";
|
|
||||||
let newSets;
|
|
||||||
if (!anySetIncomplete) {
|
|
||||||
let sets = [...this.state.sets];
|
|
||||||
const pairSeparator = this.state.pairSeparator.replace("\\n","\n");
|
|
||||||
const termDefSeparator = this.state.termDefSeparator.replace("\\n","\n");
|
|
||||||
|
|
||||||
const setsWithVocab = sets.slice(0,-1).map(set => {
|
|
||||||
let setIncomplete = this.cleanseVocabString(set.title) === "" || this.cleanseVocabString(set.text, [pairSeparator, termDefSeparator]) === "";
|
|
||||||
if (setIncomplete) {
|
|
||||||
anySetIncomplete = true;
|
|
||||||
return {
|
|
||||||
...set,
|
|
||||||
vocabChanged: false,
|
|
||||||
setIncomplete,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (set.vocabChanged) {
|
|
||||||
let vocabPairs = [];
|
|
||||||
if (pairSeparator === termDefSeparator) {
|
|
||||||
set.text.trim().split(pairSeparator).forEach((item, index, arr) => {
|
|
||||||
if (index % 2 === 0) {
|
|
||||||
let definition = "unknown";
|
|
||||||
if (index === arr.length - 1 || this.cleanseVocabString(item, [pairSeparator, termDefSeparator]) === "" || this.cleanseVocabString(arr[index + 1], [pairSeparator, termDefSeparator]) === "") {
|
|
||||||
anySetIncomplete = setIncomplete = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
definition = arr[index + 1];
|
|
||||||
}
|
|
||||||
vocabPairs.push({
|
|
||||||
term: item,
|
|
||||||
definition,
|
|
||||||
sound: false,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
vocabPairs = set.text.trim().split(pairSeparator)
|
|
||||||
.map((pair) => {
|
|
||||||
let [first, ...rest] = pair.split(termDefSeparator);
|
|
||||||
if (rest.length <= 0 || this.cleanseVocabString(first, [pairSeparator, termDefSeparator]) === "" || this.cleanseVocabString(rest.join(termDefSeparator), [pairSeparator, termDefSeparator]) === "") {
|
|
||||||
rest = "unknown";
|
|
||||||
anySetIncomplete = setIncomplete = true;
|
|
||||||
} else {
|
|
||||||
rest = rest.join(termDefSeparator);
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
term: first,
|
|
||||||
definition: rest,
|
|
||||||
sound: false,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vocabPairs.length < 1) {
|
|
||||||
anySetIncomplete = setIncomplete = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
...set,
|
|
||||||
vocabPairs,
|
|
||||||
vocabChanged: false,
|
|
||||||
setIncomplete,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (set.setIncomplete) {
|
|
||||||
anySetIncomplete = true;
|
|
||||||
}
|
|
||||||
return set;
|
|
||||||
});
|
|
||||||
newSets = setsWithVocab.concat(sets[sets.length - 1]);
|
|
||||||
} else {
|
|
||||||
newSets = [...this.state.sets];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
sets: newSets,
|
|
||||||
canSave: !anySetIncomplete,
|
|
||||||
showErrorDialog: anySetIncomplete,
|
|
||||||
}, () => {if (!anySetIncomplete) this.saveSets()});
|
|
||||||
}
|
|
||||||
|
|
||||||
onTermDefSeparatorInputChange = (event) => {
|
|
||||||
this.setState({
|
|
||||||
termDefSeparator: event.target.value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onPairSeparatorInputChange = (event) => {
|
|
||||||
this.setState({
|
|
||||||
pairSeparator: event.target.value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onSetTitleInputChange = (event, setIndex) => {
|
|
||||||
let sets = [...this.state.sets];
|
|
||||||
sets[setIndex].title = event.target.value;
|
|
||||||
this.setState({
|
|
||||||
sets,
|
|
||||||
}, () => this.handleSetDataChange());
|
|
||||||
}
|
|
||||||
|
|
||||||
onPublicSetInputChange = (event, setIndex) => {
|
|
||||||
let sets = [...this.state.sets];
|
|
||||||
sets[setIndex].public = event.target.checked;
|
|
||||||
this.setState({
|
|
||||||
sets,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onVocabInputChange = (event, setIndex) => {
|
|
||||||
let sets = [...this.state.sets];
|
|
||||||
sets[setIndex].text = event.target.value;
|
|
||||||
sets[setIndex].vocabChanged = true;
|
|
||||||
this.setState({
|
|
||||||
sets,
|
|
||||||
}, () => this.handleSetDataChange());
|
|
||||||
}
|
|
||||||
|
|
||||||
saveSets = async () => {
|
|
||||||
if (this.state.canSave) {
|
|
||||||
this.setState({
|
|
||||||
loading: true,
|
|
||||||
canSave: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const db = this.state.db;
|
|
||||||
const setCollectionRef = db.collection("sets");
|
|
||||||
|
|
||||||
let promises = [];
|
|
||||||
|
|
||||||
this.state.sets.slice(0,-1).map(async (set) => {
|
|
||||||
let setDocRef = setCollectionRef.doc();
|
|
||||||
setDocRef.set({
|
|
||||||
title: set.title,
|
|
||||||
public: set.public,
|
|
||||||
owner: this.state.user.uid,
|
|
||||||
groups: [],
|
|
||||||
}).then(() => {
|
|
||||||
let vocabCollectionRef = setDocRef.collection("vocab");
|
|
||||||
|
|
||||||
let batches = [db.batch()];
|
|
||||||
|
|
||||||
set.vocabPairs.map((vocabPair, index) => {
|
|
||||||
if (index % 248 === 0) {
|
|
||||||
promises.push(batches[batches.length - 1].commit());
|
|
||||||
batches.push(db.batch());
|
|
||||||
}
|
|
||||||
|
|
||||||
let vocabDocRef = vocabCollectionRef.doc()
|
|
||||||
return batches[batches.length - 1].set(vocabDocRef, {
|
|
||||||
term: this.removeNewLines(vocabPair.term),
|
|
||||||
definition: this.removeNewLines(vocabPair.definition),
|
|
||||||
sound: vocabPair.sound,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!batches[batches.length - 1]._delegate._committed) promises.push(batches[batches.length - 1].commit().catch(() => null));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
|
||||||
this.stopLoading();
|
|
||||||
this.props.history.push("/");
|
|
||||||
}).catch((error) => {
|
|
||||||
console.log("Couldn't create sets: " + error);
|
|
||||||
this.stopLoading();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
closeErrorDialog = () => {
|
|
||||||
this.setState({
|
|
||||||
showErrorDialog: false,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<Prompt
|
|
||||||
when={this.state.changesMade}
|
|
||||||
message="Are you sure you want to leave? You will lose any unsaved changes."
|
|
||||||
/>
|
|
||||||
|
|
||||||
<NavBar items={this.state.navbarItems} />
|
|
||||||
|
|
||||||
<main>
|
|
||||||
<div className="page-header">
|
|
||||||
<h1>Bulk Create Sets</h1>
|
|
||||||
<LinkButton to="/create-set" icon={<TuneRoundedIcon/>}>Normal</LinkButton>
|
|
||||||
</div>
|
|
||||||
<div className="bulk-create-sets-section bulk-create-sets-header">
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="term-def-separator"
|
|
||||||
onChange={this.onTermDefSeparatorInputChange}
|
|
||||||
value={this.state.termDefSeparator}
|
|
||||||
autoComplete="off"
|
|
||||||
autoCapitalize="none"
|
|
||||||
autoCorrect="off"
|
|
||||||
/>
|
|
||||||
<span>Term/definition separator</span>
|
|
||||||
</label>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="pair-separator"
|
|
||||||
onChange={this.onPairSeparatorInputChange}
|
|
||||||
value={this.state.pairSeparator}
|
|
||||||
autoComplete="off"
|
|
||||||
autoCapitalize="none"
|
|
||||||
autoCorrect="off"
|
|
||||||
/>
|
|
||||||
<span>Pair separator</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
this.state.sets.map((data, setIndex) =>
|
|
||||||
<div className="bulk-create-sets-section" key={setIndex}>
|
|
||||||
<div className="page-header">
|
|
||||||
<h2>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name={`set_${setIndex}_title`}
|
|
||||||
onChange={(event) => this.onSetTitleInputChange(event, setIndex)}
|
|
||||||
placeholder="Set Title"
|
|
||||||
value={data.title}
|
|
||||||
className="set-title-input"
|
|
||||||
autoComplete="off"
|
|
||||||
ref={(inputEl) => {if (setIndex === 0) this.firstSetNameInput = inputEl}}
|
|
||||||
/>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<Checkbox
|
|
||||||
checked={data.public}
|
|
||||||
onChange={(event) => this.onPublicSetInputChange(event, setIndex)}
|
|
||||||
inputProps={{ 'aria-label': 'checkbox' }}
|
|
||||||
/>
|
|
||||||
<span>Public</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div className="form create-set-vocab-list">
|
|
||||||
|
|
||||||
<textarea
|
|
||||||
name={`set_${setIndex}_vocab`}
|
|
||||||
onChange={(event) => this.onVocabInputChange(event, setIndex)}
|
|
||||||
value={data.text}
|
|
||||||
autoComplete="off"
|
|
||||||
autoCapitalize="none"
|
|
||||||
autoCorrect="off"
|
|
||||||
className="bulk-create-sets-text"
|
|
||||||
placeholder="Vocabulary"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
<Button
|
|
||||||
onClick={this.checkIfCanSave}
|
|
||||||
loading={this.state.loading}
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</Button>
|
|
||||||
{
|
|
||||||
this.state.showErrorDialog && <AcceptDialog acceptFunction={this.closeErrorDialog} message="Ensure all fields are filled in correctly"/>
|
|
||||||
}
|
|
||||||
</main>
|
|
||||||
<Footer />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -70,14 +70,6 @@ export default function ClassicTestStart(props) {
|
|||||||
/>
|
/>
|
||||||
<span>Ignore capitals</span>
|
<span>Ignore capitals</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
|
||||||
<Checkbox
|
|
||||||
checked={props.ignoreAccents}
|
|
||||||
onChange={props.handleIgnoreAccentsChange}
|
|
||||||
inputProps={{ 'aria-label': 'checkbox' }}
|
|
||||||
/>
|
|
||||||
<span>Ignore accents</span>
|
|
||||||
</label>
|
|
||||||
<label>
|
<label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={props.showNumberOfAnswers}
|
checked={props.showNumberOfAnswers}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { withRouter, Prompt } from "react-router-dom";
|
|||||||
import { HomeRounded as HomeRoundedIcon } from "@material-ui/icons";
|
import { HomeRounded as HomeRoundedIcon } from "@material-ui/icons";
|
||||||
import NavBar from "./NavBar";
|
import NavBar from "./NavBar";
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
import LinkButton from "./LinkButton";
|
|
||||||
import Error404 from "./Error404";
|
import Error404 from "./Error404";
|
||||||
import Footer from "./Footer";
|
import Footer from "./Footer";
|
||||||
import Checkbox from '@material-ui/core/Checkbox';
|
import Checkbox from '@material-ui/core/Checkbox';
|
||||||
@@ -138,7 +137,7 @@ export default withRouter(class EditSet extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanseVocabString = (item) => {
|
cleanseVocabString = (item) => {
|
||||||
const chars = /[\p{P}\p{S}\n ]+/ug;
|
const chars = /[\p{P}\p{S} ]+/ug;
|
||||||
return item.replace(chars, "");
|
return item.replace(chars, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,10 +360,6 @@ export default withRouter(class EditSet extends Component {
|
|||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
{
|
|
||||||
this.props.createSet &&
|
|
||||||
<LinkButton to="/create-set/bulk">Bulk add</LinkButton>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form create-set-vocab-list">
|
<div className="form create-set-vocab-list">
|
||||||
|
|||||||
82
src/Home.js
82
src/Home.js
@@ -42,80 +42,16 @@ export default function Home(props) {
|
|||||||
<br/>
|
<br/>
|
||||||
<p>To get started, click login 👆</p>
|
<p>To get started, click login 👆</p>
|
||||||
<br/>
|
<br/>
|
||||||
<p>If you have any feedback, please feel free to email us at <a href="mailto:contact@parandum.mgrove.uk">contact@parandum.mgrove.uk</a>.</p>
|
<p>If you have any feedback, please feel free to email me at <a href="mailto:parandum@mgrove.uk">parandum@mgrove.uk</a>.</p>
|
||||||
<br/>
|
<br/>
|
||||||
<div className="whats-new">
|
<h2>What's New?</h2>
|
||||||
<h2>What's New?</h2>
|
<Collapsible transitionTime={300} trigger={<>v2.0.6<ArrowDropDownRoundedIcon /></>}>
|
||||||
<Collapsible open={true} transitionTime={500} easing="ease" trigger={<>v2.3.3<ArrowDropDownRoundedIcon /></>}>
|
<ul>
|
||||||
<ul>
|
<li>Add option to show number of answers for each prompt</li>
|
||||||
<li>Bug fixes:</li>
|
<li>Ensure test options are carried over to new tests that are made from pre-existing ones (i.e. with the restart test buttons)</li>
|
||||||
<ul>
|
</ul>
|
||||||
<li>On the search page, all sets are shown instead of only the last 50 showing and previous ones being overwritten</li>
|
{/* TODO: style */}
|
||||||
</ul>
|
</Collapsible>
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.3.2<ArrowDropDownRoundedIcon /></>}>
|
|
||||||
<ul>
|
|
||||||
<li>Bug fixes:</li>
|
|
||||||
<ul>
|
|
||||||
<li>On the search page, all sets are now visible rather than just the first 48</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.3.0<ArrowDropDownRoundedIcon /></>}>
|
|
||||||
<ul>
|
|
||||||
<li>Add option to ignore accents during tests</li>
|
|
||||||
<li>Update cookie notice</li>
|
|
||||||
<li>Update contact email address</li>
|
|
||||||
<li>Add ability to bulk-create sets and bulk-add vocabulary</li>
|
|
||||||
<li>Bug fixes:</li>
|
|
||||||
<ul>
|
|
||||||
<li>Minor styling improvements</li>
|
|
||||||
<li>Efficiency improvements</li>
|
|
||||||
<li>When a set is in a group and the group is deleted, navigating to the home screen no longer throws an error</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.2.0<ArrowDropDownRoundedIcon /></>} >
|
|
||||||
<ul>
|
|
||||||
<li>Allow saving a set with no changes</li>
|
|
||||||
<li>Bug fixes:</li>
|
|
||||||
<ul>
|
|
||||||
<li>Minor styling improvements</li>
|
|
||||||
<li>Efficiency improvements</li>
|
|
||||||
<li>Users are now correctly removed from groups</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.1.9<ArrowDropDownRoundedIcon /></>}>
|
|
||||||
<ul>
|
|
||||||
<li>Add an optional on-screen configurable keyboard during tests for easier access to accented characters</li>
|
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.1.8<ArrowDropDownRoundedIcon /></>}>
|
|
||||||
<ul>
|
|
||||||
<li>Bug fixes:</li>
|
|
||||||
<ul>
|
|
||||||
<li>Test options are now set correctly when starting tests</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.1.7<ArrowDropDownRoundedIcon /></>}>
|
|
||||||
<ul>
|
|
||||||
<li>Bug fixes:</li>
|
|
||||||
<ul>
|
|
||||||
<li>Ensure backwards-compatibility with old versions of Parandum</li>
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</Collapsible>
|
|
||||||
<Collapsible transitionTime={500} easing="ease" trigger={<>v2.1.6<ArrowDropDownRoundedIcon /></>}>
|
|
||||||
<ul>
|
|
||||||
<li>Add option to show number of answers for each prompt</li>
|
|
||||||
<li>Ensure test options are carried over to new tests that are made from pre-existing ones (i.e. with the restart test buttons)</li>
|
|
||||||
</ul>
|
|
||||||
{/* TODO: style */}
|
|
||||||
</Collapsible>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
@@ -70,14 +70,6 @@ export default function LivesTestStart(props) {
|
|||||||
/>
|
/>
|
||||||
<span>Ignore capitals</span>
|
<span>Ignore capitals</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
|
||||||
<Checkbox
|
|
||||||
checked={props.ignoreAccents}
|
|
||||||
onChange={props.handleIgnoreAccentsChange}
|
|
||||||
inputProps={{ 'aria-label': 'checkbox' }}
|
|
||||||
/>
|
|
||||||
<span>Ignore accents</span>
|
|
||||||
</label>
|
|
||||||
<label>
|
<label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={props.showNumberOfAnswers}
|
checked={props.showNumberOfAnswers}
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ export default withRouter(class LoggedInHome extends React.Component {
|
|||||||
sliderValue: 1,
|
sliderValue: 1,
|
||||||
switchLanguage: false,
|
switchLanguage: false,
|
||||||
ignoreCaps: false,
|
ignoreCaps: false,
|
||||||
ignoreAccents: false,
|
|
||||||
showNumberOfAnswers: false,
|
showNumberOfAnswers: false,
|
||||||
totalTestQuestions: 1,
|
totalTestQuestions: 1,
|
||||||
pendingDeletions: {},
|
pendingDeletions: {},
|
||||||
@@ -202,7 +201,6 @@ export default withRouter(class LoggedInHome extends React.Component {
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
limit: this.state.sliderValue,
|
limit: this.state.sliderValue,
|
||||||
ignoreCaps: this.state.ignoreCaps,
|
ignoreCaps: this.state.ignoreCaps,
|
||||||
ignoreAccents: this.state.ignoreAccents,
|
|
||||||
showNumberOfAnswers: this.state.showNumberOfAnswers,
|
showNumberOfAnswers: this.state.showNumberOfAnswers,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const progressId = result.data;
|
const progressId = result.data;
|
||||||
@@ -362,12 +360,6 @@ export default withRouter(class LoggedInHome extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIgnoreAccentsChange = (event) => {
|
|
||||||
this.setState({
|
|
||||||
ignoreAccents: event.target.checked,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleShowNumberOfAnswersChange = (event) => {
|
handleShowNumberOfAnswersChange = (event) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showNumberOfAnswers: event.target.checked,
|
showNumberOfAnswers: event.target.checked,
|
||||||
@@ -534,7 +526,7 @@ export default withRouter(class LoggedInHome extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
{this.state.userGroupSets && this.state.userGroupSets.length > 0 && this.state.userGroupSets.group && typeof this.state.userGroupSets.group.data === "function" && this.state.userGroupSets
|
{this.state.userGroupSets && this.state.userGroupSets.length > 0 && this.state.userGroupSets
|
||||||
.map(data =>
|
.map(data =>
|
||||||
data.sets && data.sets.length > 0 &&
|
data.sets && data.sets.length > 0 &&
|
||||||
<div key={data.group.id} className="checkbox-list-container">
|
<div key={data.group.id} className="checkbox-list-container">
|
||||||
@@ -594,11 +586,9 @@ export default withRouter(class LoggedInHome extends React.Component {
|
|||||||
onSliderChange={this.changeSliderValue}
|
onSliderChange={this.changeSliderValue}
|
||||||
switchLanguage={this.state.switchLanguage}
|
switchLanguage={this.state.switchLanguage}
|
||||||
ignoreCaps={this.state.ignoreCaps}
|
ignoreCaps={this.state.ignoreCaps}
|
||||||
ignoreAccents={this.state.ignoreAccents}
|
|
||||||
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
||||||
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
||||||
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
||||||
handleIgnoreAccentsChange={this.handleIgnoreAccentsChange}
|
|
||||||
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
/>
|
/>
|
||||||
@@ -613,11 +603,9 @@ export default withRouter(class LoggedInHome extends React.Component {
|
|||||||
onSliderChange={this.changeSliderValue}
|
onSliderChange={this.changeSliderValue}
|
||||||
switchLanguage={this.state.switchLanguage}
|
switchLanguage={this.state.switchLanguage}
|
||||||
ignoreCaps={this.state.ignoreCaps}
|
ignoreCaps={this.state.ignoreCaps}
|
||||||
ignoreAccents={this.state.ignoreAccents}
|
|
||||||
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
||||||
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
||||||
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
||||||
handleIgnoreAccentsChange={this.handleIgnoreAccentsChange}
|
|
||||||
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
import { useEffect } from "react";
|
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import Footer from "./Footer";
|
|
||||||
import NavBar from "./NavBar";
|
|
||||||
|
|
||||||
const PlatformDisabled = (props) => {
|
|
||||||
useEffect(() => {
|
|
||||||
if (props.page) {
|
|
||||||
props.page.load();
|
|
||||||
return () => props.page.unload();
|
|
||||||
}
|
|
||||||
if (props.logEvent) props.logEvent("page_view");
|
|
||||||
}, [props, props.logEvent, props.page]);
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<NavBar items={[]} />
|
|
||||||
|
|
||||||
<main>
|
|
||||||
<div className="description-section">
|
|
||||||
<h1>Your access to Parandum has been disabled</h1>
|
|
||||||
<p>
|
|
||||||
Apologies, but due to unpaid invoices by <Link to={{pathname: "https://reading-school.co.uk"}} target="_blank">Reading School</Link> you
|
|
||||||
are currently unable to access this platform. Please contact your head of department, senior leadership team, and finance department.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<Footer />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default PlatformDisabled;
|
|
||||||
@@ -247,7 +247,7 @@ export default function PrivacyPolicy(props) {
|
|||||||
|
|
||||||
<h2>Contact Us</h2>
|
<h2>Contact Us</h2>
|
||||||
|
|
||||||
<p>If you have questions or comments about this Privacy Policy, please contact us at <a href="mailto:contact@parandum.mgrove.uk">contact@parandum.mgrove.uk</a></p>
|
<p>If you have questions or comments about this Privacy Policy, please contact us at <a href="mailto:parandum@mgrove.uk">parandum@mgrove.uk</a></p>
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
showLivesTestStart: false,
|
showLivesTestStart: false,
|
||||||
searchInput: "",
|
searchInput: "",
|
||||||
ignoreCaps: false,
|
ignoreCaps: false,
|
||||||
ignoreAccents: false,
|
|
||||||
showNumberOfAnswers: false,
|
showNumberOfAnswers: false,
|
||||||
switchLanguage: false,
|
switchLanguage: false,
|
||||||
sliderValue: 1,
|
sliderValue: 1,
|
||||||
@@ -102,7 +101,7 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
sets: reload ? querySnapshot.docs : this.state.sets.concat(querySnapshot.docs),
|
sets: reload ? querySnapshot.docs : this.state.sets.concat(querySnapshot.docs),
|
||||||
selections: selections,
|
selections: selections,
|
||||||
pageNumber: this.state.pageNumber + 1,
|
pageNumber: this.state.pageNumber + 1,
|
||||||
loadedAllSets: querySnapshot.docs.length < paginationFrequency,
|
loadedAllSets: querySnapshot.docs.length === 0,
|
||||||
loadingSets: false,
|
loadingSets: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -141,7 +140,6 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
limit: this.state.sliderValue,
|
limit: this.state.sliderValue,
|
||||||
ignoreCaps: this.state.ignoreCaps,
|
ignoreCaps: this.state.ignoreCaps,
|
||||||
ignoreAccents: this.state.ignoreAccents,
|
|
||||||
showNumberOfAnswers: this.state.showNumberOfAnswers,
|
showNumberOfAnswers: this.state.showNumberOfAnswers,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const progressId = result.data;
|
const progressId = result.data;
|
||||||
@@ -253,12 +251,6 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIgnoreAccentsChange = (event) => {
|
|
||||||
this.setState({
|
|
||||||
ignoreAccents: event.target.checked,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleShowNumberOfAnswersChange = (event) => {
|
handleShowNumberOfAnswersChange = (event) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showNumberOfAnswers: event.target.checked,
|
showNumberOfAnswers: event.target.checked,
|
||||||
@@ -317,7 +309,7 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
|
|
||||||
<div className="checkbox-list">
|
<div className="checkbox-list">
|
||||||
{
|
{
|
||||||
this.state.sets.map(set =>
|
this.state.sets.slice(-50).map(set =>
|
||||||
<div key={set.id}>
|
<div key={set.id}>
|
||||||
<label>
|
<label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@@ -334,7 +326,7 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
!this.state.loadedAllSets &&
|
!this.state.loadedAllSets && this.state.sets.length === paginationFrequency &&
|
||||||
<Button
|
<Button
|
||||||
onClick={() => this.loadSets()}
|
onClick={() => this.loadSets()}
|
||||||
disabled={this.state.loadingSets}
|
disabled={this.state.loadingSets}
|
||||||
@@ -364,11 +356,9 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
onSliderChange={this.changeSliderValue}
|
onSliderChange={this.changeSliderValue}
|
||||||
switchLanguage={this.state.switchLanguage}
|
switchLanguage={this.state.switchLanguage}
|
||||||
ignoreCaps={this.state.ignoreCaps}
|
ignoreCaps={this.state.ignoreCaps}
|
||||||
ignoreAccents={this.state.ignoreAccents}
|
|
||||||
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
||||||
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
||||||
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
||||||
handleIgnoreAccentsChange={this.handleIgnoreAccentsChange}
|
|
||||||
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
/>
|
/>
|
||||||
@@ -383,11 +373,9 @@ export default withRouter(class SearchSets extends Component {
|
|||||||
onSliderChange={this.changeSliderValue}
|
onSliderChange={this.changeSliderValue}
|
||||||
switchLanguage={this.state.switchLanguage}
|
switchLanguage={this.state.switchLanguage}
|
||||||
ignoreCaps={this.state.ignoreCaps}
|
ignoreCaps={this.state.ignoreCaps}
|
||||||
ignoreAccents={this.state.ignoreAccents}
|
|
||||||
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
||||||
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
||||||
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
||||||
handleIgnoreAccentsChange={this.handleIgnoreAccentsChange}
|
|
||||||
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ export default withRouter(class SetPage extends React.Component {
|
|||||||
sliderValue: 1,
|
sliderValue: 1,
|
||||||
switchLanguage: false,
|
switchLanguage: false,
|
||||||
ignoreCaps: false,
|
ignoreCaps: false,
|
||||||
ignoreAccents: false,
|
|
||||||
showNumberOfAnswers: false,
|
showNumberOfAnswers: false,
|
||||||
totalTestQuestions: 1,
|
totalTestQuestions: 1,
|
||||||
};
|
};
|
||||||
@@ -138,7 +137,6 @@ export default withRouter(class SetPage extends React.Component {
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
limit: this.state.sliderValue,
|
limit: this.state.sliderValue,
|
||||||
ignoreCaps: this.state.ignoreCaps,
|
ignoreCaps: this.state.ignoreCaps,
|
||||||
ignoreAccents: this.state.ignoreAccents,
|
|
||||||
showNumberOfAnswers: this.state.showNumberOfAnswers,
|
showNumberOfAnswers: this.state.showNumberOfAnswers,
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const progressId = result.data;
|
const progressId = result.data;
|
||||||
@@ -344,12 +342,6 @@ export default withRouter(class SetPage extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleIgnoreAccentsChange = (event) => {
|
|
||||||
this.setState({
|
|
||||||
ignoreAccents: event.target.checked,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleShowNumberOfAnswersChange = (event) => {
|
handleShowNumberOfAnswersChange = (event) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showNumberOfAnswers: event.target.checked,
|
showNumberOfAnswers: event.target.checked,
|
||||||
@@ -504,11 +496,9 @@ export default withRouter(class SetPage extends React.Component {
|
|||||||
onSliderChange={this.changeSliderValue}
|
onSliderChange={this.changeSliderValue}
|
||||||
switchLanguage={this.state.switchLanguage}
|
switchLanguage={this.state.switchLanguage}
|
||||||
ignoreCaps={this.state.ignoreCaps}
|
ignoreCaps={this.state.ignoreCaps}
|
||||||
ignoreAccents={this.state.ignoreAccents}
|
|
||||||
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
||||||
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
||||||
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
||||||
handleIgnoreAccentsChange={this.handleIgnoreAccentsChange}
|
|
||||||
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
disabled={!this.state.canStartTest}
|
disabled={!this.state.canStartTest}
|
||||||
@@ -524,11 +514,9 @@ export default withRouter(class SetPage extends React.Component {
|
|||||||
onSliderChange={this.changeSliderValue}
|
onSliderChange={this.changeSliderValue}
|
||||||
switchLanguage={this.state.switchLanguage}
|
switchLanguage={this.state.switchLanguage}
|
||||||
ignoreCaps={this.state.ignoreCaps}
|
ignoreCaps={this.state.ignoreCaps}
|
||||||
ignoreAccents={this.state.ignoreAccents}
|
|
||||||
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
showNumberOfAnswers={this.state.showNumberOfAnswers}
|
||||||
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
handleSwitchLanguageChange={this.handleSwitchLanguageChange}
|
||||||
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
handleIgnoreCapsChange={this.handleIgnoreCapsChange}
|
||||||
handleIgnoreAccentsChange={this.handleIgnoreAccentsChange}
|
|
||||||
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
handleShowNumberOfAnswersChange={this.handleShowNumberOfAnswersChange}
|
||||||
loading={this.state.loading}
|
loading={this.state.loading}
|
||||||
disabled={!this.state.canStartTest}
|
disabled={!this.state.canStartTest}
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ label .MuiIconButton-label > input {
|
|||||||
border-radius: 150px;
|
border-radius: 150px;
|
||||||
background: var(--primary-color-dark);
|
background: var(--primary-color-dark);
|
||||||
margin: auto;
|
margin: auto;
|
||||||
position: fixed;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -332,9 +332,6 @@ label .MuiIconButton-label > input {
|
|||||||
padding: 16px 24px;
|
padding: 16px 24px;
|
||||||
background-color: var(--primary-color-dark);
|
background-color: var(--primary-color-dark);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 300px;
|
|
||||||
max-height: 80vh;
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cookie-notice > div > p {
|
.cookie-notice > div > p {
|
||||||
@@ -427,16 +424,6 @@ label .MuiIconButton-label > input {
|
|||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Collapsible > span {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Collapsible .Collapsible__contentInner > ul {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@media screen and (max-width: 420px) {
|
@media screen and (max-width: 420px) {
|
||||||
.progress-history-container > div > *:nth-child(2), .progress-history-container--complete > div > *:nth-last-child(3), .progress-history-container--incomplete > div > *:nth-last-child(4) {
|
.progress-history-container > div > *:nth-child(2), .progress-history-container--complete > div > *:nth-last-child(3), .progress-history-container--incomplete > div > *:nth-last-child(4) {
|
||||||
|
|||||||
@@ -10,7 +10,3 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.accept-dialog > .button-container {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -26,40 +26,6 @@
|
|||||||
flex-basis: 0;
|
flex-basis: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bulk-create-sets-section {
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bulk-create-sets-header, .bulk-create-sets-header > * {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
column-gap: 24px;
|
|
||||||
row-gap: 8px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bulk-create-sets-header > * {
|
|
||||||
column-gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bulk-create-sets-header > * > input {
|
|
||||||
min-width: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bulk-create-sets-text {
|
|
||||||
min-height: 400px;
|
|
||||||
font: inherit;
|
|
||||||
background: transparent;
|
|
||||||
color: inherit;
|
|
||||||
border: 2px solid var(--overlay-color);
|
|
||||||
padding: 8px;
|
|
||||||
margin: 12px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bulk-create-sets-text:focus {
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form .checkbox-list-container {
|
.form .checkbox-list-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.overlay-content {
|
.overlay-content {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ const setTwo = "set_02";
|
|||||||
const vocabOne = "vocab_01";
|
const vocabOne = "vocab_01";
|
||||||
const termOne = "term_01";
|
const termOne = "term_01";
|
||||||
const definitionOne = "definition_01";
|
const definitionOne = "definition_01";
|
||||||
const definitionOneWithCaps = "DefinitIon_01";
|
|
||||||
const definitionOneWithAccents = "dëfiñítion_01";
|
|
||||||
const definitionOneTypoOne = "ddefinition_01";
|
const definitionOneTypoOne = "ddefinition_01";
|
||||||
const definitionOneTypoTwo = "dinition_01";
|
const definitionOneTypoTwo = "dinition_01";
|
||||||
const definitionOneTypoThree = "dinition_02";
|
const definitionOneTypoThree = "dinition_02";
|
||||||
@@ -129,9 +127,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
sets: [setOne],
|
sets: [setOne],
|
||||||
mode: "questions",
|
mode: "questions",
|
||||||
limit: 2,
|
limit: 2,
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const progressId = await createProgress(requestData);
|
const progressId = await createProgress(requestData);
|
||||||
@@ -169,7 +164,7 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("createProgress can create new questions mode progress file from multiple existing sets with all test aids enabled", async () => {
|
it("createProgress can create new questions mode progress file from multiple existing sets", async () => {
|
||||||
const createProgress = test.wrap(cloudFunctions.createProgress);
|
const createProgress = test.wrap(cloudFunctions.createProgress);
|
||||||
|
|
||||||
const setDataOne = {
|
const setDataOne = {
|
||||||
@@ -223,9 +218,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
sets: [setOne, setTwo],
|
sets: [setOne, setTwo],
|
||||||
mode: "questions",
|
mode: "questions",
|
||||||
limit: 4,
|
limit: 4,
|
||||||
ignoreAccents: true,
|
|
||||||
ignoreCaps: true,
|
|
||||||
showNumberOfAnswers: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const progressId = await createProgress(requestData);
|
const progressId = await createProgress(requestData);
|
||||||
@@ -249,7 +241,7 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
assert.strictEqual(snapAfter.typo, false);
|
assert.strictEqual(snapAfter.typo, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("createProgress can create new lives mode progress file from existing set with no test aids enabled", async () => {
|
it("createProgress can create new lives mode progress file from existing set", async () => {
|
||||||
const createProgress = test.wrap(cloudFunctions.createProgress);
|
const createProgress = test.wrap(cloudFunctions.createProgress);
|
||||||
|
|
||||||
const setDataOne = {
|
const setDataOne = {
|
||||||
@@ -279,9 +271,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
sets: [setOne],
|
sets: [setOne],
|
||||||
mode: "lives",
|
mode: "lives",
|
||||||
limit: 2,
|
limit: 2,
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const progressId = await createProgress(requestData);
|
const progressId = await createProgress(requestData);
|
||||||
@@ -339,9 +328,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
sets: [setOne],
|
sets: [setOne],
|
||||||
mode: "questions",
|
mode: "questions",
|
||||||
limit: 2,
|
limit: 2,
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
firebase.assertSucceeds(createProgress(requestData));
|
firebase.assertSucceeds(createProgress(requestData));
|
||||||
@@ -377,9 +363,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
sets: [setTwo],
|
sets: [setTwo],
|
||||||
mode: "questions",
|
mode: "questions",
|
||||||
limit: 2,
|
limit: 2,
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
firebase.assertFails(createProgress(requestData));
|
firebase.assertFails(createProgress(requestData));
|
||||||
@@ -406,9 +389,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -568,372 +548,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
assert.strictEqual(snapAfterCorrectData.typo, false);
|
assert.strictEqual(snapAfterCorrectData.typo, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("processAnswer updates progress documents appropriately when correct and incorrect answers provided with ignore caps enabled", async () => {
|
|
||||||
const processAnswer = test.wrap(cloudFunctions.processAnswer);
|
|
||||||
|
|
||||||
const progressData = {
|
|
||||||
correct: [],
|
|
||||||
current_correct: [],
|
|
||||||
duration: null,
|
|
||||||
incorrect: [],
|
|
||||||
progress: 0,
|
|
||||||
questions: [
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabTwo
|
|
||||||
],
|
|
||||||
set_title: setOne,
|
|
||||||
set_titles: [setOne],
|
|
||||||
start_time: 1627308670962,
|
|
||||||
switch_language: false,
|
|
||||||
uid: userOne,
|
|
||||||
mode: "questions",
|
|
||||||
typo: false,
|
|
||||||
setIds: [setOne],
|
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: true,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
|
||||||
const termDataOne = {
|
|
||||||
"item": termOne,
|
|
||||||
"sound": soundOne,
|
|
||||||
};
|
|
||||||
const termDataTwo = {
|
|
||||||
"item": termTwo,
|
|
||||||
"sound": soundTwo,
|
|
||||||
};
|
|
||||||
const definitionDataOne = {
|
|
||||||
"item": definitionOne,
|
|
||||||
"sound": soundOne,
|
|
||||||
};
|
|
||||||
const definitionDataTwo = {
|
|
||||||
"item": definitionTwo,
|
|
||||||
"sound": soundTwo,
|
|
||||||
};
|
|
||||||
|
|
||||||
const progressId = "progress_01";
|
|
||||||
const progressDocId = firestore.collection("progress").doc(progressId);
|
|
||||||
|
|
||||||
await progressDocId.set(progressData);
|
|
||||||
await progressDocId.collection("terms").doc(progressVocabOne)
|
|
||||||
.set(termDataOne);
|
|
||||||
await progressDocId.collection("terms").doc(progressVocabTwo)
|
|
||||||
.set(termDataTwo);
|
|
||||||
await progressDocId.collection("definitions").doc(progressVocabOne)
|
|
||||||
.set(definitionDataOne);
|
|
||||||
await progressDocId.collection("definitions").doc(progressVocabTwo)
|
|
||||||
.set(definitionDataTwo);
|
|
||||||
|
|
||||||
const firstTermAnswerRequestData = {
|
|
||||||
progressId: progressId,
|
|
||||||
answer: definitionOne,
|
|
||||||
};
|
|
||||||
const secondTermAnswerRequestData = {
|
|
||||||
progressId: progressId,
|
|
||||||
answer: definitionTwo,
|
|
||||||
};
|
|
||||||
const incorrectAnswerRequestData = {
|
|
||||||
progressId: progressId,
|
|
||||||
answer: definitionOneWithCaps,
|
|
||||||
};
|
|
||||||
|
|
||||||
const firstReturn = await processAnswer(incorrectAnswerRequestData);
|
|
||||||
|
|
||||||
hamjest.assertThat(firstReturn, hamjest.anyOf(
|
|
||||||
hamjest.is({
|
|
||||||
mode: "questions",
|
|
||||||
correct: false,
|
|
||||||
correctAnswers: [definitionOne],
|
|
||||||
currentVocabId: progressVocabOne,
|
|
||||||
moreAnswers: false,
|
|
||||||
nextPrompt: {
|
|
||||||
item: termOne,
|
|
||||||
sound: soundOne,
|
|
||||||
set_owner: userOne,
|
|
||||||
},
|
|
||||||
progress: 1,
|
|
||||||
totalQuestions: 3,
|
|
||||||
totalCorrect: 0,
|
|
||||||
totalIncorrect: 1,
|
|
||||||
typo: false,
|
|
||||||
}),
|
|
||||||
hamjest.is({
|
|
||||||
mode: "questions",
|
|
||||||
correct: false,
|
|
||||||
correctAnswers: [definitionOne],
|
|
||||||
currentVocabId: progressVocabOne,
|
|
||||||
moreAnswers: false,
|
|
||||||
nextPrompt: {
|
|
||||||
item: termTwo,
|
|
||||||
sound: soundTwo,
|
|
||||||
set_owner: userOne,
|
|
||||||
},
|
|
||||||
progress: 1,
|
|
||||||
totalQuestions: 3,
|
|
||||||
totalCorrect: 0,
|
|
||||||
totalIncorrect: 1,
|
|
||||||
typo: false,
|
|
||||||
})
|
|
||||||
));
|
|
||||||
|
|
||||||
const snapAfterIncorrectData = await progressDocId.get().then((doc) => doc.data());
|
|
||||||
|
|
||||||
hamjest.assertThat(snapAfterIncorrectData, hamjest.anyOf(
|
|
||||||
hamjest.is({
|
|
||||||
correct: [],
|
|
||||||
current_correct: [],
|
|
||||||
duration: null,
|
|
||||||
incorrect: [progressVocabOne],
|
|
||||||
progress: 1,
|
|
||||||
questions: [
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabTwo
|
|
||||||
],
|
|
||||||
set_title: setOne,
|
|
||||||
set_titles: [setOne],
|
|
||||||
start_time: 1627308670962,
|
|
||||||
switch_language: false,
|
|
||||||
uid: userOne,
|
|
||||||
mode: "questions",
|
|
||||||
typo: false,
|
|
||||||
setIds: [setOne],
|
|
||||||
}),
|
|
||||||
hamjest.is({
|
|
||||||
correct: [],
|
|
||||||
current_correct: [],
|
|
||||||
duration: null,
|
|
||||||
incorrect: [progressVocabOne],
|
|
||||||
progress: 1,
|
|
||||||
questions: [
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabTwo,
|
|
||||||
progressVocabOne
|
|
||||||
],
|
|
||||||
set_title: setOne,
|
|
||||||
set_titles: [setOne],
|
|
||||||
start_time: 1627308670962,
|
|
||||||
switch_language: false,
|
|
||||||
uid: userOne,
|
|
||||||
mode: "questions",
|
|
||||||
typo: false,
|
|
||||||
setIds: [setOne],
|
|
||||||
})
|
|
||||||
));
|
|
||||||
|
|
||||||
if (firstReturn.nextPrompt.item === termOne) {
|
|
||||||
await processAnswer(firstTermAnswerRequestData);
|
|
||||||
await processAnswer(secondTermAnswerRequestData);
|
|
||||||
} else {
|
|
||||||
await processAnswer(secondTermAnswerRequestData);
|
|
||||||
await processAnswer(firstTermAnswerRequestData);
|
|
||||||
}
|
|
||||||
|
|
||||||
const snapAfterCorrectData = await progressDocId.get().then((doc) => doc.data());
|
|
||||||
|
|
||||||
hamjest.assertThat(snapAfterCorrectData.correct, hamjest.anyOf(
|
|
||||||
hamjest.is([progressVocabOne, progressVocabTwo]),
|
|
||||||
hamjest.is([progressVocabTwo, progressVocabOne])
|
|
||||||
));
|
|
||||||
hamjest.assertThat(snapAfterCorrectData.questions, hamjest.anyOf(
|
|
||||||
hamjest.is([progressVocabOne, progressVocabOne, progressVocabTwo]),
|
|
||||||
hamjest.is([progressVocabOne, progressVocabTwo, progressVocabOne])
|
|
||||||
));
|
|
||||||
assert.deepStrictEqual(snapAfterCorrectData.incorrect, [progressVocabOne]);
|
|
||||||
assert.deepStrictEqual(snapAfterCorrectData.current_correct, []);
|
|
||||||
assert.notStrictEqual(snapAfterCorrectData.duration, null);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.progress, 3);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.set_title, setOne);
|
|
||||||
assert.deepStrictEqual(snapAfterCorrectData.set_titles, [setOne]);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.start_time, 1627308670962);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.switch_language, false);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.uid, userOne);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.mode, "questions");
|
|
||||||
assert.strictEqual(snapAfterCorrectData.typo, false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("processAnswer updates progress documents appropriately when correct and incorrect answers provided with ignore accents enabled", async () => {
|
|
||||||
const processAnswer = test.wrap(cloudFunctions.processAnswer);
|
|
||||||
|
|
||||||
const progressData = {
|
|
||||||
correct: [],
|
|
||||||
current_correct: [],
|
|
||||||
duration: null,
|
|
||||||
incorrect: [],
|
|
||||||
progress: 0,
|
|
||||||
questions: [
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabTwo
|
|
||||||
],
|
|
||||||
set_title: setOne,
|
|
||||||
set_titles: [setOne],
|
|
||||||
start_time: 1627308670962,
|
|
||||||
switch_language: false,
|
|
||||||
uid: userOne,
|
|
||||||
mode: "questions",
|
|
||||||
typo: false,
|
|
||||||
setIds: [setOne],
|
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: true,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
|
||||||
const termDataOne = {
|
|
||||||
"item": termOne,
|
|
||||||
"sound": soundOne,
|
|
||||||
};
|
|
||||||
const termDataTwo = {
|
|
||||||
"item": termTwo,
|
|
||||||
"sound": soundTwo,
|
|
||||||
};
|
|
||||||
const definitionDataOne = {
|
|
||||||
"item": definitionOne,
|
|
||||||
"sound": soundOne,
|
|
||||||
};
|
|
||||||
const definitionDataTwo = {
|
|
||||||
"item": definitionTwo,
|
|
||||||
"sound": soundTwo,
|
|
||||||
};
|
|
||||||
|
|
||||||
const progressId = "progress_01";
|
|
||||||
const progressDocId = firestore.collection("progress").doc(progressId);
|
|
||||||
|
|
||||||
await progressDocId.set(progressData);
|
|
||||||
await progressDocId.collection("terms").doc(progressVocabOne)
|
|
||||||
.set(termDataOne);
|
|
||||||
await progressDocId.collection("terms").doc(progressVocabTwo)
|
|
||||||
.set(termDataTwo);
|
|
||||||
await progressDocId.collection("definitions").doc(progressVocabOne)
|
|
||||||
.set(definitionDataOne);
|
|
||||||
await progressDocId.collection("definitions").doc(progressVocabTwo)
|
|
||||||
.set(definitionDataTwo);
|
|
||||||
|
|
||||||
const firstTermAnswerRequestData = {
|
|
||||||
progressId: progressId,
|
|
||||||
answer: definitionOne,
|
|
||||||
};
|
|
||||||
const secondTermAnswerRequestData = {
|
|
||||||
progressId: progressId,
|
|
||||||
answer: definitionTwo,
|
|
||||||
};
|
|
||||||
const incorrectAnswerRequestData = {
|
|
||||||
progressId: progressId,
|
|
||||||
answer: definitionOneWithAccents,
|
|
||||||
};
|
|
||||||
|
|
||||||
const firstReturn = await processAnswer(incorrectAnswerRequestData);
|
|
||||||
|
|
||||||
hamjest.assertThat(firstReturn, hamjest.anyOf(
|
|
||||||
hamjest.is({
|
|
||||||
mode: "questions",
|
|
||||||
correct: false,
|
|
||||||
correctAnswers: [definitionOne],
|
|
||||||
currentVocabId: progressVocabOne,
|
|
||||||
moreAnswers: false,
|
|
||||||
nextPrompt: {
|
|
||||||
item: termOne,
|
|
||||||
sound: soundOne,
|
|
||||||
set_owner: userOne,
|
|
||||||
},
|
|
||||||
progress: 1,
|
|
||||||
totalQuestions: 3,
|
|
||||||
totalCorrect: 0,
|
|
||||||
totalIncorrect: 1,
|
|
||||||
typo: false,
|
|
||||||
}),
|
|
||||||
hamjest.is({
|
|
||||||
mode: "questions",
|
|
||||||
correct: false,
|
|
||||||
correctAnswers: [definitionOne],
|
|
||||||
currentVocabId: progressVocabOne,
|
|
||||||
moreAnswers: false,
|
|
||||||
nextPrompt: {
|
|
||||||
item: termTwo,
|
|
||||||
sound: soundTwo,
|
|
||||||
set_owner: userOne,
|
|
||||||
},
|
|
||||||
progress: 1,
|
|
||||||
totalQuestions: 3,
|
|
||||||
totalCorrect: 0,
|
|
||||||
totalIncorrect: 1,
|
|
||||||
typo: false,
|
|
||||||
})
|
|
||||||
));
|
|
||||||
|
|
||||||
const snapAfterIncorrectData = await progressDocId.get().then((doc) => doc.data());
|
|
||||||
|
|
||||||
hamjest.assertThat(snapAfterIncorrectData, hamjest.anyOf(
|
|
||||||
hamjest.is({
|
|
||||||
correct: [],
|
|
||||||
current_correct: [],
|
|
||||||
duration: null,
|
|
||||||
incorrect: [progressVocabOne],
|
|
||||||
progress: 1,
|
|
||||||
questions: [
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabTwo
|
|
||||||
],
|
|
||||||
set_title: setOne,
|
|
||||||
set_titles: [setOne],
|
|
||||||
start_time: 1627308670962,
|
|
||||||
switch_language: false,
|
|
||||||
uid: userOne,
|
|
||||||
mode: "questions",
|
|
||||||
typo: false,
|
|
||||||
setIds: [setOne],
|
|
||||||
}),
|
|
||||||
hamjest.is({
|
|
||||||
correct: [],
|
|
||||||
current_correct: [],
|
|
||||||
duration: null,
|
|
||||||
incorrect: [progressVocabOne],
|
|
||||||
progress: 1,
|
|
||||||
questions: [
|
|
||||||
progressVocabOne,
|
|
||||||
progressVocabTwo,
|
|
||||||
progressVocabOne
|
|
||||||
],
|
|
||||||
set_title: setOne,
|
|
||||||
set_titles: [setOne],
|
|
||||||
start_time: 1627308670962,
|
|
||||||
switch_language: false,
|
|
||||||
uid: userOne,
|
|
||||||
mode: "questions",
|
|
||||||
typo: false,
|
|
||||||
setIds: [setOne],
|
|
||||||
})
|
|
||||||
));
|
|
||||||
|
|
||||||
if (firstReturn.nextPrompt.item === termOne) {
|
|
||||||
await processAnswer(firstTermAnswerRequestData);
|
|
||||||
await processAnswer(secondTermAnswerRequestData);
|
|
||||||
} else {
|
|
||||||
await processAnswer(secondTermAnswerRequestData);
|
|
||||||
await processAnswer(firstTermAnswerRequestData);
|
|
||||||
}
|
|
||||||
|
|
||||||
const snapAfterCorrectData = await progressDocId.get().then((doc) => doc.data());
|
|
||||||
|
|
||||||
hamjest.assertThat(snapAfterCorrectData.correct, hamjest.anyOf(
|
|
||||||
hamjest.is([progressVocabOne, progressVocabTwo]),
|
|
||||||
hamjest.is([progressVocabTwo, progressVocabOne])
|
|
||||||
));
|
|
||||||
hamjest.assertThat(snapAfterCorrectData.questions, hamjest.anyOf(
|
|
||||||
hamjest.is([progressVocabOne, progressVocabOne, progressVocabTwo]),
|
|
||||||
hamjest.is([progressVocabOne, progressVocabTwo, progressVocabOne])
|
|
||||||
));
|
|
||||||
assert.deepStrictEqual(snapAfterCorrectData.incorrect, [progressVocabOne]);
|
|
||||||
assert.deepStrictEqual(snapAfterCorrectData.current_correct, []);
|
|
||||||
assert.notStrictEqual(snapAfterCorrectData.duration, null);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.progress, 3);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.set_title, setOne);
|
|
||||||
assert.deepStrictEqual(snapAfterCorrectData.set_titles, [setOne]);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.start_time, 1627308670962);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.switch_language, false);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.uid, userOne);
|
|
||||||
assert.strictEqual(snapAfterCorrectData.mode, "questions");
|
|
||||||
assert.strictEqual(snapAfterCorrectData.typo, false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("processAnswer returns correct data", async () => {
|
it("processAnswer returns correct data", async () => {
|
||||||
const processAnswer = test.wrap(cloudFunctions.processAnswer);
|
const processAnswer = test.wrap(cloudFunctions.processAnswer);
|
||||||
|
|
||||||
@@ -954,9 +568,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1042,9 +653,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1238,9 +846,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1302,9 +907,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1356,9 +958,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1408,9 +1007,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1462,9 +1058,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1516,9 +1109,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1570,9 +1160,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1622,9 +1209,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1676,9 +1260,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1730,9 +1311,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: true,
|
typo: true,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1786,9 +1364,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: true,
|
typo: true,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1846,9 +1421,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne, setTwo],
|
setIds: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -1909,9 +1481,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne, setTwo],
|
setIds: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const completedProgressData = {
|
const completedProgressData = {
|
||||||
attempts: 1,
|
attempts: 1,
|
||||||
@@ -1985,9 +1554,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -2059,9 +1625,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const groupOneData = {
|
const groupOneData = {
|
||||||
role: "owner",
|
role: "owner",
|
||||||
@@ -2137,9 +1700,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -2197,9 +1757,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
mode: "questions",
|
mode: "questions",
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne],
|
setIds: [setOne],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
"item": termOne,
|
"item": termOne,
|
||||||
@@ -2594,9 +2151,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne, setTwo],
|
setIds: [setOne, setTwo],
|
||||||
set_titles: [setOne, setTwo],
|
set_titles: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
term: termOne,
|
term: termOne,
|
||||||
@@ -2701,9 +2255,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
lives: 2,
|
lives: 2,
|
||||||
start_lives: 5,
|
start_lives: 5,
|
||||||
set_titles: [setOne, setTwo],
|
set_titles: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
term: termOne,
|
term: termOne,
|
||||||
@@ -2803,9 +2354,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
current_correct: [],
|
current_correct: [],
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne, setTwo],
|
setIds: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
term: termOne,
|
term: termOne,
|
||||||
@@ -2868,9 +2416,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
current_correct: [],
|
current_correct: [],
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne, setTwo],
|
setIds: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
term: termOne,
|
term: termOne,
|
||||||
@@ -2939,9 +2484,6 @@ describe("Parandum Cloud Functions", function () {
|
|||||||
current_correct: [],
|
current_correct: [],
|
||||||
typo: false,
|
typo: false,
|
||||||
setIds: [setOne, setTwo],
|
setIds: [setOne, setTwo],
|
||||||
ignoreAccents: false,
|
|
||||||
ignoreCaps: false,
|
|
||||||
showNumberOfAnswers: false,
|
|
||||||
};
|
};
|
||||||
const termDataOne = {
|
const termDataOne = {
|
||||||
term: termOne,
|
term: termOne,
|
||||||
|
|||||||
Reference in New Issue
Block a user