From ecac8edcc3638c312cad1bc682681b163bc32a10 Mon Sep 17 00:00:00 2001
From: ibgk1 <180229633+ibgk1@users.noreply.github.com>
Date: Tue, 3 Jun 2025 20:02:05 -0400
Subject: [PATCH 1/2] updated Contributing-Generators.md to direct to Handbook
---
docs/contributing-generators.md | 105 +-------------------------------
1 file changed, 2 insertions(+), 103 deletions(-)
diff --git a/docs/contributing-generators.md b/docs/contributing-generators.md
index 74a9d439..858a5ffb 100644
--- a/docs/contributing-generators.md
+++ b/docs/contributing-generators.md
@@ -1,105 +1,4 @@
# Contributing Generators
-In this project, a "generator" is a class that creates new varients of an existing question.
-
-Checkout the example generator for question "COMP 2804 Midterm 2013 - 1" [here](https://questions.carletoncomputerscience.ca/questions/generator/comp2804/2013-fall-midterm/1).
-
-Users can navigate to a question's generator to practice that specific question varient by clicking on the "create sparkles" found under the original question.
-
-Any question where the "create sparkles" are disabled is a question that does not currently have an associated generator and is an oppurtunity for a student to contribute to the project.
-
-
-
-
-
-# Create a Generator
-
-## TLDR: Follow the golden example
-
-The Golden example for how generators should be implemented is stored here: `src/content/questions/comp2804/2013-fall-midterm/1`
-
-## 0. Pick a question without a generator
-
-Go through the website and find a question that has it's "create sparkles" button disabled.
-
-## 1. Find your base question
-
-Each generator is associated with a base question, so we need to first find where that question is stored in the project.
-
-Each question is stored within the project's `src/content/questions` folder.
-
-Inside that folder, you'll find many sub folders with the path pattern `{evaluation}/{question number}` continue to the folder of your base question.
-
-## 2. Create your `generator.ts` file
-
-Create a `generator.ts` file in your question's folder and copy paste this base code into your `generator.ts`.
-
-```typescript
-import { MultipleChoiceQuestionGenerator } from "@common/MultipleChoiceQuestionGenerator";
-import type {
- MultipleChoiceQuestion,
- MultipleChoiceQuestionOption,
-} from "@common/MultipleChoiceQuestionGenerator";
-
-class Generator extends MultipleChoiceQuestionGenerator {
- generateQuestion(): MultipleChoiceQuestion {
- return {
- body: "example body",
- options: [
- {
- label: "option1",
- correct: true,
- },
- {
- label: "option2",
- correct: false,
- },
- {
- label: "option3",
- correct: false,
- },
- {
- label: "option4",
- correct: false,
- },
- ],
- };
- }
-}
-
-export default Generator;
-```
-
-## 3. Associate your generator and question
-
-For the website to know your generator exists, you need to update your question's `index.md` file as shown where `{evaluation}` and `{question-number}` are replaced with the data related to your question.
-
-```diff
----
-title: N/A
-path: comp2804/{evaluation}/{question-number}
-type: multiple-choice
-author: Pat Morin
-question: comp2804/{evaluation}/{question-number}/question.ts
-+ generator: comp2804/{evaluation}/{question-number}/generator.ts
-```
-
-If you now navigate to your question in the website, the "create sparkles" will now be clickable and should take you to a page that appears like the following:
-
-
-
-## 4. Implementing your generator
-
-At this point, it's up to you to understand the logic behind how your question works to determine how your `generator.ts` should generate the "body" and option "label" strings that are returned back by the generator. You can structure your class methods however you'd like or in whatever way best suits the approach needing for the problem.
-
-Check if your question already has a written `solution.md` file to verify your logic matches the solution for the question.
-
-## 5. Add Tests
-
-For each generator please create an associated `generator.test.ts` file with unit tests that verify the behavior of your code.
-
-You can run these tests by running the whole test suite: `npm run test` or by running your specific test file `npm run test src/content/questions/comp2804/{evaluation}/{question-number}/generator.test.ts`.
-
-## 6. Create a Pull Request
-
-Create a pull request with your new generator code. If you are unfamilliar with creating a pull request, see [this guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
+> **Note:** This page has been moved to the CCSS Handbook.
+> New link: [CCSS Handbook](https://handbook.carletoncomputersciencesociety.ca/)
From c5f7f6634e3858a4e9f12286bdb2c120595b4321 Mon Sep 17 00:00:00 2001
From: ibgk1 <180229633+ibgk1@users.noreply.github.com>
Date: Tue, 5 Aug 2025 11:40:49 -0400
Subject: [PATCH 2/2] Dockerfile added, DockerIgnore added, Docker compose
added, fixed a little bit of npm run build errors
---
.dockerignore | 30 ++++++++++++++++
Dockerfile | 36 +++++++++++++++++++
docker-compose.yml | 7 ++++
package-lock.json | 7 ++++
package.json | 1 +
.../comp2804/2013-fall-midterm/15/question.ts | 2 +-
src/pages/lectures.astro | 14 ++++++--
7 files changed, 94 insertions(+), 3 deletions(-)
create mode 100644 .dockerignore
create mode 100644 Dockerfile
create mode 100644 docker-compose.yml
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..324d4bf2
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,30 @@
+# Node stuff that will be (re)installed inside image
+node_modules
+npm-debug.log
+yarn-error.log
+
+# Build outputs / local dev artifacts
+dist
+/.astro
+/.vercel
+/.turbo
+
+# Git metadata
+.git
+.gitignore
+
+# Editor/OS cruft
+.vscode/
+*.swp
+.DS_Store
+
+# Local environment files (could contain secrets)
+.env
+.env.local
+.env.*.local
+
+# Logs
+*.log
+
+# Optional: if you have scripts or assets not needed in build context
+tests/
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..7cb05120
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,36 @@
+# Step 1: Build the Astro site
+FROM node:18-alpine AS build
+
+# Set working directory
+WORKDIR /app
+
+# Install dependencies
+COPY package*.json ./
+RUN npm install
+
+# Copy all files
+COPY . .
+
+# Expose default static site port
+EXPOSE 10000
+
+#run
+# CMD ["npm", "run", "dev"]
+
+# # update in future
+# # Step 2: Use a lightweight image to serve the site
+# FROM node:18-alpine
+
+# # Install a static server (you could also use nginx here)
+# RUN npm install -g serve
+
+# # Set working directory
+# WORKDIR /app
+
+# # # Copy built files from previous stage
+# COPY --from=build /app/dist .
+
+# # # Start the static server
+# CMD ["serve", "-s", ".", "-l", "10000"]
+
+
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 00000000..9f6430cd
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,7 @@
+version: '3.8'
+
+services:
+ astro:
+ build: .
+ ports:
+ - "3000:10000"
diff --git a/package-lock.json b/package-lock.json
index 6a677547..34867031 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -26,6 +26,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.12",
+ "@types/js-yaml": "^4.0.9",
"@types/katex": "^0.16.7",
"@types/node": "^20.14.9",
"jest": "^29.7.0",
@@ -2881,6 +2882,12 @@
"pretty-format": "^29.0.0"
}
},
+ "node_modules/@types/js-yaml": {
+ "version": "4.0.9",
+ "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",
+ "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==",
+ "dev": true
+ },
"node_modules/@types/katex": {
"version": "0.16.7",
"resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz",
diff --git a/package.json b/package.json
index 70be73e0..7a311c0c 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
},
"devDependencies": {
"@types/jest": "^29.5.12",
+ "@types/js-yaml": "^4.0.9",
"@types/katex": "^0.16.7",
"@types/node": "^20.14.9",
"jest": "^29.7.0",
diff --git a/src/content/questions/comp2804/2013-fall-midterm/15/question.ts b/src/content/questions/comp2804/2013-fall-midterm/15/question.ts
index 3af8a61a..ce3d801a 100644
--- a/src/content/questions/comp2804/2013-fall-midterm/15/question.ts
+++ b/src/content/questions/comp2804/2013-fall-midterm/15/question.ts
@@ -4,7 +4,7 @@ export const question: MultipleChoiceQuestion = {
body: "If you flip a fair coin 4 times, what is the probability that the coin comes up heads exactly twice?",
options: [
{ label: "$1/{{4}\\choose{2}}$", correct: false },
- { label: "$2/2^{4}$", false: true },
+ { label: "$2/2^{4}$", correct: true },// npm run build error due to false:true cahnged to correcT:true
{ label: "$2^{4}/{{4}\\choose{2}}$", correct: false },
{ label: "${{4}\\choose{2}}/2^{4}$", correct: true },
],
diff --git a/src/pages/lectures.astro b/src/pages/lectures.astro
index 8edda97a..c5923012 100644
--- a/src/pages/lectures.astro
+++ b/src/pages/lectures.astro
@@ -6,11 +6,21 @@ import fs from "fs";
import path from "path";
import yaml from "js-yaml";
+
+//fixed type error in lectures
+//downloaded js-yaml in package.json
+interface Lecture{
+ course: string;
+ link: string;
+ title: string;
+}
+
+
const filePath = path.resolve("src/data/lectures.yml");
const file = fs.readFileSync(filePath, "utf8");
-const lectures = yaml.load(file);
+const lectures:Lecture[] = yaml.load(file) as Lecture[];
-const grouped = {};
+const grouped: Record = {};
for (const lec of lectures) {
if (!grouped[lec.course]) grouped[lec.course] = [];
grouped[lec.course].push(lec);