-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Note: I highlight recommend copy pasting this issue description to chatgpt (or equivalent) as this should be something it can handle writting or creating a basis for quickly
It will vastly improve the time it takes to tag questions if we have a script that can add a new tag when a question's body contains a certain substring.
Ex: if a question contains the string "bitstring", give the question the "comp2804-bitstring" tag
Questions live in a folder called src/content/questions
Every question has a index.md file and a question.ts file.
Tags are stored contained on the ```index.md``, ex:
---
title: N/A
path: comp2804/exam-fall-2014/1
type: multiple-choice
author: Michiel Smid
question: comp2804/exam-fall-2014/1/question.ts
tags:
- comp2804
- comp2804-exam
---
The question body is stored on question.ts, ex:
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";
const body = String.raw`
A password consists of 13 characters, each character being one of the ten digits $0,1,2,\dots,9$. <br>
A password must contain exactly one odd digit. How many passwords are there?
`;
const label1 = String.raw`$13 \cdot 5^{12}$`;
const label2 = String.raw`$13 \cdot 5^{13}$`;
const label3 = String.raw`$13 \cdot 9^{12}$`;
const label4 = String.raw`$13 \cdot 5 \cdot 9^{12}$`;
export const question: MultipleChoiceQuestion = {
body: body,
options: [
{ label: label1, correct: false },
{ label: label2, correct: true },
{ label: label3, correct: false },
{ label: label4, correct: false },
],
};
You should be able to dynamically import each question and check whether question.body contains the desired substring.
The script should look over every single question that is contained in the src/content/questions folder. This folder structure could hypothetically vary in depth within each subfolder.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status