Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
53d6e92
styling changes to list items, new courses load on creation
dvcabiya Mar 10, 2025
f40b3ea
dropdown working on edit assignment, just need to put it on add assig…
dvcabiya Mar 11, 2025
29d92d9
added --build to command
RA341 Mar 12, 2025
8e6413f
finished, dropdown is now on both pages
dvcabiya Mar 12, 2025
0088c7b
updated readme
RA341 Mar 12, 2025
aebb1d3
added metadata field tag
RA341 Mar 12, 2025
a4fe3fc
added create-migration script
RA341 Mar 12, 2025
b8a8eed
changed dropdown value from additional option created at random to an…
dvcabiya Mar 12, 2025
7cd5d9c
category set empty after submission
dvcabiya Mar 12, 2025
76f41ab
changed homepage failed to load text
dvcabiya Mar 12, 2025
bcc1f04
nearly all changes to gradebook are done, now experimenting with late…
dvcabiya Mar 13, 2025
7fd9a30
finished! added late/nosub to student gradebook, redid course average…
dvcabiya Mar 13, 2025
025ebbc
Add the modal for the add grader code
SameepK Mar 14, 2025
ad44376
Added the modal for the add grader for code
SameepK Mar 14, 2025
50150bf
Merge pull request #231 from makeopensource/#80-Add-Grder-Modal
SameepK Mar 14, 2025
39d6ca1
removed submissions list from submissionDetailPage - 71
NeemZ16 Mar 14, 2025
bdd563b
fixed footer positioning to be bottom of page instead of bottom of vi…
NeemZ16 Mar 14, 2025
7067e0b
fixed footer width overflowing - 71
NeemZ16 Mar 14, 2025
a68cc03
added manualGradeModal - 71
NeemZ16 Mar 14, 2025
a678f9c
added styling foundations for feedback page, added page header and ba…
NeemZ16 Mar 14, 2025
3584e51
added border styling for sections, rendering for problem scores - 71
NeemZ16 Mar 15, 2025
bbc7d11
updated scores section styling - 71
NeemZ16 Mar 15, 2025
b7551e9
added assignment score to scores section - 71
NeemZ16 Mar 15, 2025
ddc93fd
added instructor feedback rendering - 71
NeemZ16 Mar 15, 2025
e8a24ad
displaying autograder feedback from problem - 71
NeemZ16 Mar 15, 2025
2921804
added functionality to view source and back buttons - 71
NeemZ16 Mar 15, 2025
7f6ab69
linked assignment in feedback header - 71
NeemZ16 Mar 15, 2025
bd23f1f
previous functionality of manually grading restored, added assignment…
NeemZ16 Mar 15, 2025
59a3e78
added text overflow protection to feedback and problem titles - 71
NeemZ16 Mar 15, 2025
8944e9c
Merge branch 'develop' into 77-category-dropdowns
dvcabiya Mar 17, 2025
e254ab9
fix ncag serializer
RA341 Mar 24, 2025
da91097
Merge pull request #235 from makeopensource/75-ncag-question-types
RA341 Mar 24, 2025
dd0e617
added leviathan to dev compose
RA341 Mar 24, 2025
11dd97c
Merge pull request #233 from makeopensource/71-view-feedback
dvcabiya Mar 25, 2025
d25f60d
new file for mcq modal, basic functionality done. options will be sto…
dvcabiya Mar 25, 2025
e976a6d
modal done, will need future updates but works for basic functionality
dvcabiya Mar 26, 2025
cfd5383
some page padding changes, added text to modal
dvcabiya Mar 26, 2025
4407c75
changed number of options to 5
dvcabiya Mar 26, 2025
e17a824
added update problem score URL
NeemZ16 Mar 26, 2025
71c573d
added problems and scores to manual grade modal
NeemZ16 Mar 26, 2025
6303787
added back error messages in client build
RA341 Mar 26, 2025
08807d2
Merge remote-tracking branch 'origin/develop' into develop
RA341 Mar 26, 2025
b2b2eb3
added request to update problem score - 81
NeemZ16 Mar 26, 2025
215a221
temporarily fixed types in problemScores - 81
NeemZ16 Mar 26, 2025
3e5d0d3
made buttons have lower opacity on disabled, moved assignment problem…
dvcabiya Mar 27, 2025
0d7495e
progress on getting type from assignment, for some reason ncag has me…
dvcabiya Mar 27, 2025
34efc8b
typing worksgit add . now just need to make the interface D:
dvcabiya Mar 27, 2025
cb00552
started mcq rendering, type distinction finished
dvcabiya Mar 27, 2025
463d349
works! selecting the correct mcq answer provides proper points
dvcabiya Mar 28, 2025
f3e61cf
made a pretty checkbox and it works good but still doesn't support mu…
dvcabiya Mar 28, 2025
d6fae10
added new mcq to edit page awww yeah
dvcabiya Mar 28, 2025
6ba4108
multiple answers now supported bb yeaaahhhhhhh
dvcabiya Mar 29, 2025
a57825f
Merge branch 'develop' of https://github.com/makeopensource/devU into…
RA341 Mar 31, 2025
9679774
added frontend url in nginx
RA341 Mar 31, 2025
ca3e474
fixed typo in request url
NeemZ16 Mar 31, 2025
9b7118e
fixed bug in add problem modal, added onchange to cag timeout field - 86
NeemZ16 Mar 31, 2025
6a7c2fb
updated submission styling
NeemZ16 Mar 31, 2025
4071125
handle file added
NeemZ16 Mar 31, 2025
de459f6
switched to leviathan
RA341 Mar 31, 2025
c37b6e9
updated type
RA341 Mar 31, 2025
cdb0f85
placeholder for new cag model
RA341 Mar 31, 2025
96a19cd
changed path
RA341 Mar 31, 2025
e838c42
updated cag entity
RA341 Mar 31, 2025
e0de53a
minor fix
RA341 Mar 31, 2025
904687b
fixed input model
RA341 Mar 31, 2025
52cf32c
removed log
RA341 Mar 31, 2025
6e57196
new fields
RA341 Mar 31, 2025
fdbf875
changed grader to use leviathan
RA341 Mar 31, 2025
f8df42b
added leviathan service, removed tango
RA341 Mar 31, 2025
46a2ac9
fix controller
RA341 Mar 31, 2025
21437b9
fix api url
RA341 Mar 31, 2025
48973af
Merge pull request #236 from makeopensource/83-mcq-modal
RA341 Apr 1, 2025
e226fce
Merge pull request #239 from makeopensource/82-multiple-choice-questions
RA341 Apr 1, 2025
649c2ce
added swap radio<->cb behavior for buttons
dvcabiya Apr 1, 2025
d0568b6
fix conflicts
dvcabiya Apr 1, 2025
bf56f35
finished behavior for radio/checkbox, works on both pages where displ…
dvcabiya Apr 1, 2025
5af7147
Merge pull request #229 from makeopensource/77-category-dropdowns
RA341 Apr 1, 2025
1845cfa
revert changes
RA341 Apr 1, 2025
9aa52af
Merge pull request #240 from makeopensource/85-add-leviathan
RA341 Apr 1, 2025
5bd000e
fixed close modal errors and added a createdAt check to distinguish i…
dvcabiya Apr 1, 2025
e24e0d1
removed tango
RA341 Apr 1, 2025
5db3cb5
Merge branch 'develop' into 76-submission-rendering
dvcabiya Apr 1, 2025
0a306fa
removed testing info
dvcabiya Apr 1, 2025
11c3115
removed tango env check
RA341 Apr 1, 2025
67c8f84
updated compose and deploy script
RA341 Apr 1, 2025
5159289
Merge pull request #242 from makeopensource/85-add-leviathan
RA341 Apr 1, 2025
9a5c3e5
Update example-docker-compose.yml
RA341 Apr 1, 2025
e941630
removed extra command
RA341 Apr 1, 2025
cc6c3cb
Merge pull request #230 from makeopensource/76-submission-rendering
RA341 Apr 1, 2025
b4daa5a
fixed conflicts
dvcabiya Apr 2, 2025
4f4e529
added placeholder for handleFile
NeemZ16 Apr 2, 2025
4d40ee4
changed join course to primary button
NeemZ16 Apr 2, 2025
168d4d9
create course navigates to created course on success
NeemZ16 Apr 2, 2025
bf00803
create assignment navigates to edit assignment on success
NeemZ16 Apr 2, 2025
2970d31
fixed automatic end date selection
NeemZ16 Apr 2, 2025
16ecc85
removed unused component imports
NeemZ16 Apr 2, 2025
d24dd54
init code to compare autograder and instr feedback
NeemZ16 Apr 2, 2025
a05f276
added buttons for decrease/increase options, changed join course page…
dvcabiya Apr 2, 2025
24f4008
Merge pull request #238 from makeopensource/81-manual-grade-problems
dvcabiya Apr 3, 2025
b3d4354
adding options works fine but need to add behavior for removal
dvcabiya Apr 3, 2025
9fc765c
added the attendance page
SameepK Apr 3, 2025
64bccff
added the attendance page.
SameepK Apr 3, 2025
6e74464
updated the frontend of the page.
SameepK Apr 3, 2025
2ddabbe
now totally implemented, options can be increased up to 10 and decrea…
dvcabiya Apr 3, 2025
b34439a
added comment to update backend - 95
NeemZ16 Apr 4, 2025
30c79b1
removed optional from end date - 95
NeemZ16 Apr 4, 2025
80dd253
removed unnecessary alert
NeemZ16 Apr 4, 2025
97cce6d
added reload to page on text ncag creation
NeemZ16 Apr 4, 2025
b99be85
timeout field now works - 95
NeemZ16 Apr 4, 2025
8e58f9e
updated formatting for readability
NeemZ16 Apr 4, 2025
e8cb37d
removed file upload and updated styling for assignment detail page - 95
NeemZ16 Apr 4, 2025
835d258
Merge branch 'develop' into 95-bug-fixes
NeemZ16 Apr 4, 2025
f4ad8ae
Merge pull request #244 from makeopensource/95-bug-fixes
NeemZ16 Apr 4, 2025
20cc4d5
Merge branch 'develop' into 89-single-answer-mcq
dvcabiya Apr 5, 2025
3e95525
Merge pull request #241 from makeopensource/89-single-answer-mcq
dvcabiya Apr 5, 2025
aab54f2
Merge branch 'develop' into 92-mcq-options
dvcabiya Apr 5, 2025
449f640
Merge pull request #243 from makeopensource/92-mcq-options
dvcabiya Apr 5, 2025
c308301
Update and rename AddProblemModal.tsx to codeProblemModal.tsx
SameepK Apr 5, 2025
c6b5431
Merge branch 'develop' into #87-Attendance-page
SameepK Apr 5, 2025
e04e005
Merge pull request #246 from makeopensource/#87-Attendance-page
SameepK Apr 5, 2025
3740b01
fixed problems not showing up when created
dvcabiya Apr 5, 2025
8a19016
Merge pull request #247 from makeopensource/99-problem-appears
dvcabiya Apr 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**/node_modules
/logs
/devU-api/src/tango/tests/test_files
/devU-api/src/autograders/tango/tests/test_files
.env.*
6 changes: 0 additions & 6 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,3 @@ jobs:

docker build . -f api.Dockerfile -t $IMAGE_NAME
docker push $IMAGE_NAME

- name: build tango docker
run: |
IMAGE_NAME=ghcr.io/${{ env.repo_url }}/tango:${{ steps.get_branch.outputs.branch_name }}
docker build ./tango -f ./tango/Dockerfile -t $IMAGE_NAME
docker push $IMAGE_NAME
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion client.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ COPY ./devU-client/ .
COPY --from=module_builder /tmp/devu-shared-modules ./devu-shared-modules

# build frontend during run so that we can modify baseurl via docker envoirment
CMD npm run --silent build-docker && rm -rf /out/* && cp -r /app/dist/* /out
CMD npm run build-docker && rm -rf /out/* && cp -r /app/dist/* /out
138 changes: 35 additions & 103 deletions devU-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,104 +11,37 @@ For now the only reason we're including docker is to more easily control the dev

## Running the Project Locally

### Getting Everything Started

Once you've got these installed, we can build our container and run it

#### Note to run the postgres container locally using the command below

You have to modify `devU-api/src/environment.ts`

change

`dbHost: (load('database.host') || 'localhost') as string`

to

`dbHost: 'localhost'`

This will probably be fixed in the future but for now the above steps are necessary

#### Using docker compose

We use [docker compose profiles](https://docs.docker.com/compose/profiles/) to selectively start services in the main docker-compose when developing.

Assuming you are in api dir `devU-api`, To start all api services except the api run

```
npm run api-services
```

To stop the services

```
npm run api-services-stop
```

Then install dependencies using

```
npm install
```

Once you've got all the dependencies installed you can run the project via

```
npm start
```

#### Manually:

```
docker run \
--name typeorm-postgres \
-p 5432:5432 \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=typescript_api \
-e POSTGRES_USER=typescript_user \
-d postgres
```

Install all node dependencies. All of the database environment variables can change, and can be set as environment variables on your machine if you want to overwrite the defaults

```
docker run \
--name minio \
-p 9002:9000 \
-p 9001:9001 \
-v /tmp/data:/data \
-e "MINIO_ROOT_USER=typescript_user" \
-e "MINIO_ROOT_PASSWORD=changeMe" \
-d minio/minio server /data --console-address ":9001"
```

Install all node dependencies. All of the database environment variables can change, and can be set as environment variables on your machine if you want to overwrite the defaults

```
npm install
```

Run the setup script to create local development auth keys. These are used in local development for signing and authenticating JWTs.

```
npm run generate-config
```

Run the initial migrations to setup our DB schema

```
npm run typeorm -- migration:run -d src/database.ts
```

Once you've got all the dependencies installed you can run the project via

```
npm start
```

By default the project runs at `localhost:3001`, but you can change the port by setting an alternate port by setting the `PORT` environment variable.

If you're working in vscode, a configuration has been included to allow for debugging. Open up the VS Code Run and Debug section and click `Debug API`.
### Quick Start

The instructions below assume you are in the api dir `/devU-api/`

You must have the following tools installed

* Docker
* Node >= v20

Once you've got these installed,

1. We use [docker compose profiles](https://docs.docker.com/compose/profiles/)
to selectively start services in the main docker-compose when developing.
This starts all required services for the api depends (database, frontend etc.)
```
npm run api-services
```

To remove all related containers
```
npm run api-services-stop
```

2. Install dependencies using
```
npm install
```
3. Once you've got all the dependencies installed you can run the project via
```
npm run start
```

### Convenient Devtools

Expand Down Expand Up @@ -173,7 +106,7 @@ Here's what you need to know:

Here's the basic layout of the application

![control flow of the api](/docs/controlFlow.png 'Control Flow')
![control flow of the api](./docs/controlFlow.png 'Control Flow')

Let's take this from the top

Expand Down Expand Up @@ -218,9 +151,8 @@ When developing if you need to create a new type,

This will update the types in `devU-api` and `devU-client` folders.

**Note if the types are not being detected by your IDE**

**Go to the `devU-api/` and `devU-client/` and run `npm install` in each folder to update the shared modules.**
if the types are not being detected, Go to the `devU-api/` and `devU-client/`
and run `npm install` in each folder to update the shared modules.

### Testing

Expand Down Expand Up @@ -257,7 +189,7 @@ I wouldn't recommend digging that far down as the of tests should be more human-
If the schema needs to be updated, you can do so by updating the models and running

```
npm run typeorm migration:generate -- -d src/database src/migration/<generatedMigrationName>
npm run create-migration someMeaningfulMigrationName
```

Doing so will attempt to create an auto migration from any changes within the `src/models` directory and add it to `src/migrations`. If an auto migration is generated for you (always check your auto migrations), you can run it with the above migration command
Expand Down
7 changes: 5 additions & 2 deletions devU-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
"create-migrate": "npx typeorm-ts-node-commonjs migration:generate -d src/database.ts",
"update-shared": "cd ../devU-shared && npm run build-local && cd ../devU-api && npm i",
"typeorm": "typeorm-ts-node-commonjs",
"create-migration": "ts-node scripts/create-migration.ts",
"test": "jest --passWithNoTests",
"clean": "rimraf build/*",
"lint": "tsc",
"build": "npm-run-all clean lint",
"format": "prettier --write \"./**/*.{js,ts,json,md}\"",
"pre-commit": "lint-staged",
"populate-db": "ts-node-dev ./scripts/populate-db.ts",
"tango": "ts-node-dev ./src/tango/tests/tango.endpoint.test.ts",
"api-services": "docker compose -f ../docker-compose.yml --profile dev-api up",
"tango": "ts-node-dev src/autograders/tango/tests/tango.endpoint.test.ts",
"api-services": "docker compose -f ../docker-compose.yml --profile dev-api up --build",
"api-services-stop": "docker compose -f ../docker-compose.yml --profile dev-api stop"
},
"lint-staged": {
Expand Down Expand Up @@ -67,9 +68,11 @@
"cors": "^2.8.5",
"devu-shared-modules": "./devu-shared-modules",
"express": "^4.17.1",
"express-list-endpoints": "^7.1.1",
"express-validator": "^6.14.2",
"helmet": "^4.6.0",
"jsonwebtoken": "^9.0.2",
"leviathan-node-sdk": "https://gitpkg.vercel.app/makeopensource/leviathan/spec/leviathan_node?dev",
"minio": "^8.0.0",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1",
Expand Down
26 changes: 26 additions & 0 deletions devU-api/scripts/create-migration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { exec } from 'child_process'

// Get the migration name from command line arguments
const migrationName = process.argv[2]

if (!migrationName) {
console.error('Migration name is required!')
console.error('Usage: npm run create-mig MigrationName')
process.exit(1)
}

const command = `npm run typeorm -- migration:generate -d src/database.ts src/migration/${migrationName}`
console.log(`Executing: ${command}`)

// Execute the command
exec(command, (error, stdout, stderr) => {
if (stdout) console.log(stdout)
if (stderr) console.error(stderr)

if (error) {
console.error(`Error: ${error.message}`)
process.exit(1)
}

console.log('Migration file created successfully!')
})
115 changes: 115 additions & 0 deletions devU-api/src/autograders/leviathan.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import {
CancelJobRequest,
createClient,
createConnectTransport,
DockerFile,
JobLogRequest,
JobService,
LabData,
LabFile,
LabService,
NewJobRequest,
NewLabRequest,
SubmissionFile,
UploadLabFiles,
UploadSubmissionFiles,
} from 'leviathan-node-sdk'


const leviUrl = process.env.LEVIATHAN_URL || 'http://localhost:9221'
console.log(`Leviathan url set to ${leviUrl}`)

const transport = createConnectTransport({
baseUrl: leviUrl,
httpVersion: '2',
})

const jobService = createClient(JobService, transport)
const labService = createClient(LabService, transport)

export function bufferToBlob(multerFile: Express.Multer.File): Blob {
return new Blob([multerFile.buffer], { type: multerFile.mimetype })
}

export async function sendSubmission(labId: bigint, submission: Array<SubmissionFile>) {
const fileId = await UploadSubmissionFiles(leviUrl, submission)
const resp = await jobService.newJob(<NewJobRequest>{
tmpSubmissionFolderId: fileId,
labID: labId,
})

return resp.jobId
}


export async function createNewLab(lab: LabData, dockerfile: DockerFile, labFiles: Array<LabFile>) {
const fileId = await UploadLabFiles(leviUrl, dockerfile, labFiles)
const resp = await labService.newLab(<NewLabRequest>{
labData: lab,
tmpFolderId: fileId,
})

return resp.labId
}

/**
* streams job status,
* the stream will exit on its own once the job is done, can be cancelled by calling controller.abort()
* @returns a stream and a controller can be used to cancel the stream
* @see waitForJob - for usage example
*/
export function streamJob(jobId: string) {
const controller = new AbortController()
const dataStream = jobService.streamStatus(
<JobLogRequest>{ jobId },
{ signal: controller.signal },
)

return { dataStream, controller }
}


/**
* gets current job status with logs
*/
export async function getStatus(jobId: string) {
const resp = await jobService.getStatus(<JobLogRequest>{ jobId })
// strip out grpc metadata
const { $unknown, $typeName, ...info } = resp.jobInfo!
const logs = resp.logs
return { info, logs }
}

/**
* Blocks until job is complete
* @see streamJob - is used under the hood
*/
export async function waitForJob(jobId: string) {
const { dataStream } = streamJob(jobId)

let jobInfo: { jobId: string; status: string; statusMessage: string } = {
jobId: '',
status: '',
statusMessage: '',
}
let logs: string = ''

for await (const chunk of dataStream) {
if (!chunk.jobInfo) {
console.warn('Empty job state')
continue
}

const { $unknown, $typeName, ...rest } = chunk.jobInfo!
console.debug('Job', rest)

jobInfo = rest
logs = chunk.logs
}

return { jobInfo, logs }
}

export async function cancelJob(jobId: string) {
await jobService.cancelJob(<CancelJobRequest>{ jobId })
}
12 changes: 8 additions & 4 deletions devU-api/src/entities/assignment/assignment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ export async function listByCourse(courseId: number) {
export async function listByCourseReleased(courseId: number) {
// TODO: filter by start date after current time
// const now = new Date(Date.now())
const allAssignments = await connect().findBy({ courseId: courseId, /*startDate: MoreThanOrEqual(now),*/ deletedAt: IsNull() })

// console.log("ASSIGNMENTS WITH FILTER: ", allAssignments)

return allAssignments;
return await connect().findBy({
courseId: courseId, /*startDate: MoreThanOrEqual(now),*/
deletedAt: IsNull(),
})
}

export async function isReleased(id: number) {
Expand All @@ -87,7 +88,10 @@ export async function isReleased(id: number) {
}

async function getMaxSubmissionsAndDeadline(id: number) {
return await connect().findOne({ where: { id: id, deletedAt: IsNull() }, select: ['maxSubmissions', 'maxFileSize', 'disableHandins', 'endDate'] })
return await connect().findOne({
where: { id: id, deletedAt: IsNull() },
select: ['maxSubmissions', 'maxFileSize', 'disableHandins', 'endDate'],
})
}

async function processFiles(req: Request) {
Expand Down
Loading
Loading