Updated the MatchSentences exercise to work better now

This commit is contained in:
Tiago Ribeiro
2024-03-26 00:42:39 +00:00
parent 7d0d930140
commit 1086e78936
16 changed files with 251 additions and 135 deletions

View File

@@ -124,7 +124,6 @@ const ReadingGeneration = () => {
const availableTypes = [
{type: "fillBlanks", label: "Fill the Blanks"},
{type: "multipleChoice", label: "Multiple Choice"},
{type: "trueFalse", label: "True or False"},
{type: "writeBlanks", label: "Write the Blanks"},
{type: "matchSentences", label: "Match Sentences"},

View File

@@ -29,14 +29,14 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
module: Module;
endpoint: string;
topic?: string;
exercises?: string[];
exercises?: string[] | string;
difficulty?: Difficulty;
};
const url = `${process.env.BACKEND_URL}/${endpoint}`;
const params = new URLSearchParams();
if (topic) params.append("topic", topic);
if (exercises) exercises.forEach((exercise) => params.append("exercises", exercise));
if (exercises) (typeof exercises === "string" ? [exercises] : exercises).forEach((exercise) => params.append("exercises", exercise));
if (difficulty) params.append("difficulty", difficulty);
const result = await axios.get(`${url}${params.toString().length > 0 ? `?${params.toString()}` : ""}`, {

View File

@@ -74,7 +74,11 @@ export default function History({user}: {user: User}) {
setGroupedStats(
groupByDate(
stats.filter((x) => {
if ((x.module === "writing" || x.module === "speaking") && !x.isDisabled && !x.solutions.every((y) => "evaluation" in y))
if (
(x.module === "writing" || x.module === "speaking") &&
!x.isDisabled &&
!x.solutions.every((y) => Object.keys(y).includes("evaluation"))
)
return false;
return true;
}),