Skip to content

Commit

Permalink
resolved comments, multi problems code assessment
Browse files Browse the repository at this point in the history
  • Loading branch information
RhythmAgg committed Mar 7, 2024
1 parent c181226 commit af2f88d
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 61 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const Lab = {
const Experiment = {
descriptor_name: "experiment-descriptor.json",
default_descriptor: "default-experiment-descriptor.json",
default_code_assessment: "default-code-assessment.json",
build_dir: "build",
exp_dir: "experiment",
ui_template_name: "templates",
Expand Down
28 changes: 21 additions & 7 deletions default-code-assessment.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
{
"version": 1.0,
"name": "Experiment Name",
"inputs": [
[1,2,3]
],
"expected": "1,2,3"
}
"version": 1,
"experiment name": "Experiment Name",
"problems": [
{
"problem name": "Basic Bubble Sort",
"description": "Implement basic Bubble Sort algorithm for the given input array",
"inputs": [
[64,66,20,49,11,79]
],
"expected": ["11,20,49,64,66,79"]
},
{
"problem name": "Optimized Bubble Sort",
"description": "Implement Optimized Bubble Sort algorithm for the given input array",
"inputs": [
[64,66,20,49,11,79]
],
"expected": ["11,20,49,64,66,79"]
}
]
}
6 changes: 0 additions & 6 deletions exp_build/exp_gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ function run(src, lab_data, build_options) {
// Include code-assessment.json if the code editor is included
if(code_assessment.include)
{
if (!shell.test("-f", Experiment.codeAssessmentPath(src))) {
shell.cp(
path.resolve(Config.Experiment.default_code_assessment),
path.resolve(this.src, Experiment.codeAssessmentPath(src))
);
}
log.info("Code Editor included")
build_options.codeditor = true;
build_options.code_assessment = code_assessment;
Expand Down
4 changes: 2 additions & 2 deletions exp_build/experiment.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ class Experiment {
this.descriptor.units.push(contributors);
}

includeCodeEditor(position = 6) {
includeCodeEditor(position = 5) {
const codeditor = {
"target": "code-assessment.html",
"label": "Code Assessment",
"source": "codeditor.json",
"source": "code-assessment.json",
"unit-type": "task",
"content-type": "component",
};
Expand Down
2 changes: 1 addition & 1 deletion validation/schema-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"pretest.json": "./schemas/quizSchema.js",
"experiment-descriptor.json": "./schemas/descriptorSchema.js",
"assessment": "./schemas/quizSchema.js",
"code-assessment.json": "./schemas/codeAssessment.js"
"code-assessment.json": "./schemas/code-assessment.js"
}
75 changes: 75 additions & 0 deletions validation/schemas/code-assessment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
module.exports = {
$schema: "http://json-schema.org/draft-07/schema#",
$id: "https://virtual.labs/schemas/code-assessment.json",
type: "object",
properties: {
"version": {
type: "integer",
enum: [1.0],
errorMessage: "Version should be 1.0",
},
},
required: ['version'],
if: { properties: { version: { const: 1.0 } }, required: ["version"] },
then: {
properties: {
"experiment name": {
type: "string",
errorMessage: {
type: "The experiment name should be a string",
},
},
"problems": {
type: "array",
items: {
type: "object",
properties: {
"problem name": {
type: "string",
errorMessage: {
type: "The problem name should be a string",
},
},
"description": {
type: "string",
errorMessage: {
type: "The description should be a string",
},
},
"inputs": {
type: "array",
errorMessage: {
type: "The inputs should be an array",
},
},
"expected": {
type: "array",
errorMessage: {
type: "The expected should be an array",
},
}
},
required: ["problem name", "description", "inputs", "expected"],
errorMessage: {
required: {
"problem name": "The name of the problem field is required",
"description": "The description is required",
"inputs": "The inputs field is required",
"expected": "The expected field is required"
}
},
},
errorMessage: {
type: "The problems must be an array",
},
}
},
required: ["experiment name", "problems"],
errorMessage: {
required: {
name: "The name of the experiment field is required",
problems: "The problems field is required",
}
},
}
}
44 changes: 0 additions & 44 deletions validation/schemas/codeAssessment.js

This file was deleted.

0 comments on commit af2f88d

Please sign in to comment.