diff --git a/oer/courses/c-basics/sections/11-strings/01-introduction/execute.sh b/oer/courses/c-basics/sections/11-strings/01-introduction/execute.sh
deleted file mode 100755
index 0b7cd4f..0000000
--- a/oer/courses/c-basics/sections/11-strings/01-introduction/execute.sh
+++ /dev/null
@@ -1 +0,0 @@
-gcc -std=c99 -o program.c program
diff --git a/oer/courses/c-basics/sections/11-strings/01-introduction/program.c b/oer/courses/c-basics/sections/11-strings/01-introduction/program.c
index 3d2f11e..32d261a 100644
--- a/oer/courses/c-basics/sections/11-strings/01-introduction/program.c
+++ b/oer/courses/c-basics/sections/11-strings/01-introduction/program.c
@@ -12,7 +12,7 @@ int main(int argc, const char *argv[])
// Standard library functions such as printf relay on the null-termination
char faulty[] = {'H', 'e', 'l', 'l', 'o'};
- // This will segfault
+ // This might segfault
printf("%s\n", faulty);
// TODO: fix the char array definiton to avoid our programm segfaulting.
// Why do we get a segmentation fault?
diff --git a/oer/courses/c-basics/sections/11-strings/01-introduction/type b/oer/courses/c-basics/sections/11-strings/01-introduction/type
index 1bb833c..7d393ec 100644
--- a/oer/courses/c-basics/sections/11-strings/01-introduction/type
+++ b/oer/courses/c-basics/sections/11-strings/01-introduction/type
@@ -1 +1 @@
-program/scriptgrade
+program/match-regex
diff --git a/oer/courses/example-course/sections/01-introduction/00-weclome/content.html b/oer/courses/example-course/sections/01-introduction/00-welcome/content.html
similarity index 100%
rename from oer/courses/example-course/sections/01-introduction/00-weclome/content.html
rename to oer/courses/example-course/sections/01-introduction/00-welcome/content.html
diff --git a/oer/courses/example-course/sections/01-introduction/00-weclome/meta b/oer/courses/example-course/sections/01-introduction/00-welcome/meta
similarity index 100%
rename from oer/courses/example-course/sections/01-introduction/00-weclome/meta
rename to oer/courses/example-course/sections/01-introduction/00-welcome/meta
diff --git a/oer/courses/example-course/sections/01-introduction/00-weclome/type b/oer/courses/example-course/sections/01-introduction/00-welcome/type
similarity index 100%
rename from oer/courses/example-course/sections/01-introduction/00-weclome/type
rename to oer/courses/example-course/sections/01-introduction/00-welcome/type
diff --git a/oer/exercise-formats/program/match-regex/controller.py b/oer/exercise-formats/program/match-regex/controller.py
index 3fc81f5..b3802ab 100755
--- a/oer/exercise-formats/program/match-regex/controller.py
+++ b/oer/exercise-formats/program/match-regex/controller.py
@@ -33,8 +33,8 @@ def execute(ctx):
if ctx.build_result[0] != 0:
return
- allArgs = ("/usr/bin/docker run -h oer-worker --user 1001:65534 --rm -v /data/run/jobs/%s/:/data/ kunkel/oer-worker /data/program" % ctx.id).split(" ")
- #print(" ".join(allArgs), file=sys.stderr)
+ allArgs = ("/usr/bin/docker run -h oer-worker --user 1001:65534 --rm -v /data/run/jobs/%s/:/data/ --network none kunkel/oer-worker /data/program" % ctx.id).split(" ")
+ print(" ".join(allArgs), file=sys.stderr)
p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path)
timeout = 1
diff --git a/oer/exercise-formats/program/match-regex/script.js b/oer/exercise-formats/program/match-regex/script.js
index b5449b1..2ebcad7 100755
--- a/oer/exercise-formats/program/match-regex/script.js
+++ b/oer/exercise-formats/program/match-regex/script.js
@@ -8,11 +8,10 @@ $(document).ready(function () {
html = "";
if (type == "test") {
-
} else {
if (msg.data.grade == "PASS") {
html = '
Great! Your solution is correct.
';
- $("#continue").prop( "disabled", false);
+ //$("#continue").prop( "disabled", false);
} else if (msg.data.grade == "FAIL") {
html = 'Sorry! That is not correct.
';
} else {
@@ -21,9 +20,7 @@ $(document).ready(function () {
// a possible message that is generated yb the server to give tips?
}
}
-
-
- console.log(output)
+ //console.log(output)
if ( output == "" ) {
output = " "
}
@@ -45,7 +42,7 @@ $(document).ready(function () {
job = {}
job.submit = function (action) {
-
+ $("#output").html("Submitted ... Processing ...");
//console.log("Test submission issued..");
//console.log( $("#c-code").val() );
@@ -66,24 +63,22 @@ $(document).ready(function () {
job_id = msg['id'];
setTimeout(function(){ job.status(action, job_id); }, 100);
-
+ })
+ .error(function(jqXHR, textStatus, errorThrown ){
+ response.show("test", "", "Error: " + errorThrown);
});
};
job.status = function (type, job_id) {
//console.log(type)
-
- e = {"blub": "hm"};
- json_data = JSON.stringify(e);
-
$.ajax({
method: "GET",
url: "/api/rest/job/" + job_id + "/",
contentType: 'application/json',
})
.done(function( msg ) {
- console.log("Status received: " + msg );
- console.log(msg);
+ //console.log("Status received: " + msg );
+ //console.log(msg);
if ( msg.status == 'SUCCESS' ) {
response.show(type, msg, msg.data.output);
@@ -91,19 +86,21 @@ $(document).ready(function () {
response.show(type, "processing...", false);
setTimeout(function(){ job.status(type, job_id); }, 1000);
}
-
+ })
+ .error(function(jqXHR, textStatus, errorThrown ){
+ response.show("test", "", "Error: " + errorThrown);
});
};
$("#submit-test").click(function(event) {
- $("#submit-test").prop( "disabled", true);
+ //$("#submit-test").prop( "disabled", true);
job.submit("test");
});
$("#submit-grade").click(function(event) {
- $("#submit-grade").prop( "disabled", true);
+ //$("#submit-grade").prop( "disabled", true);
job.submit("grade");
});
@@ -113,7 +110,6 @@ $(document).ready(function () {
//$("#submit-test").prop( "disabled", true);
//job.submit("test");
-
target = event.target
@@ -123,10 +119,6 @@ $(document).ready(function () {
// also check/uncheck when clicking surounding
}
- //if ( $(target).children("input").attr('type') == 'radio' ) {
- // $(target).parent().children(".list-group-item-success").removeClass("list-group-item-success");
- //}
-
console.log(target)
$(target).children("input").each(function () { this.checked = !this.checked; console.log(this) });
//$(target).toggleClass("list-group-item-success");
diff --git a/oer/exercise-formats/program/scriptgrade/controller.py b/oer/exercise-formats/program/scriptgrade/controller.py
index 033562e..5da88c8 100644
--- a/oer/exercise-formats/program/scriptgrade/controller.py
+++ b/oer/exercise-formats/program/scriptgrade/controller.py
@@ -27,8 +27,8 @@ def build(ctx):
def execute(ctx):
- allArgs = ['/usr/bin/make', 'execute']
- allArgs = ['./execute.sh']
+ allArgs = ("/usr/bin/docker run -h oer-worker --user 1001:65534 --rm -v /data/run/jobs/%s/:/data/ --network none kunkel/oer-worker /data/execute.sh" % ctx.id).split(" ")
+ print(" ".join(allArgs), file=sys.stderr)
# start subprocess in with work_path as cwd
p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path)
@@ -57,10 +57,8 @@ def grade(ctx):
# if build failed, return early and set grade to FAIL
if ctx.build_result[0] != 0:
return 'FAIL'
-
- print(ctx.execute_result, file=sys.stderr)
-
allArgs = ['./test.sh']
+ print(" ".join(allArgs), file=sys.stderr)
# start subprocess in with work_path as cwd
p = subprocess.Popen(allArgs, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=ctx.work_path)
diff --git a/oer/exercise-formats/program/scriptgrade/script.js b/oer/exercise-formats/program/scriptgrade/script.js
deleted file mode 100755
index 208f30e..0000000
--- a/oer/exercise-formats/program/scriptgrade/script.js
+++ /dev/null
@@ -1,138 +0,0 @@
-$(document).ready(function () {
-
- response = {};
-
- response.show = function (type, msg, output) {
- console.log("show issued" + type + msg);
-
- html = "";
-
- if (type == "test") {
-
- } else {
- if (msg.data.grade == "PASS") {
- html = 'Great! Your solution is correct.
';
- $("#continue").prop( "disabled", false);
- } else if (msg.data.grade == "FAIL") {
- html = 'Sorry! That is not correct.
';
- } else {
- // assume test
- //html = msg;
- // a possible message that is generated yb the server to give tips?
- }
- }
-
-
- console.log(output)
- if ( output == "" ) {
- output = " "
- }
-
- if ( output != false) {
- console.log("output is not false")
- $("#output-wrapper").show(500);
- $("#output").html(output);
- }
-
- $("#response").hide().html(html).show(500);
-
-
- $("#submit-test").prop( "disabled", false);
- $("#submit-grade").prop( "disabled", false);
-
- }
-
-
- job = {}
- job.submit = function (action) {
-
- console.log("Test submission issued..");
- console.log( $("#c-code").val() );
-
- submission = {"solution": cEditor.getValue(), "cmd": "run.sh", "action": action, "slide": window.data.slide};
- submission_json = JSON.stringify(submission);
-
- console.log(submission_json)
-
- $.ajax({
- method: "POST",
- url: "/api/rest/job/new/",
- contentType: 'application/json',
- data: submission_json
- })
- .done(function( msg ) {
- console.log("Job submitted: " + msg );
- console.log(msg);
-
- job_id = msg['id'];
- setTimeout(function(){ job.status(action, job_id); }, 1000);
-
- });
- };
-
- job.status = function (type, job_id) {
-
- console.log(type)
-
- e = {"blub": "hm"};
- json_data = JSON.stringify(e);
-
- $.ajax({
- method: "GET",
- url: "/api/rest/job/" + job_id + "/",
- contentType: 'application/json',
- })
- .done(function( msg ) {
- console.log("Status received: " + msg );
- console.log(msg);
-
- if ( msg.status == 'SUCCESS' ) {
- response.show(type, msg, msg.data.output);
- } else {
- response.show(type, "processing...", false);
- setTimeout(function(){ job.status(type, job_id); }, 3000);
- }
-
- });
-
- };
-
-
- $("#submit-test").click(function(event) {
- $("#submit-test").prop( "disabled", true);
- job.submit("test");
- });
-
- $("#submit-grade").click(function(event) {
- $("#submit-grade").prop( "disabled", true);
- job.submit("grade");
- });
-
-
- $("#exercise-choices a.list-group-item").click(function(event) {
- event.preventDefault()
- //$("#submit-test").prop( "disabled", true);
- //job.submit("test");
-
-
- target = event.target
-
-
- if ( $(target).is('input') ) {
- target = $(event.target).parent()[0]
- } else {
- // also check/uncheck when clicking surounding
- }
-
- //if ( $(target).children("input").attr('type') == 'radio' ) {
- // $(target).parent().children(".list-group-item-success").removeClass("list-group-item-success");
- //}
-
- console.log(target)
- $(target).children("input").each(function () { this.checked = !this.checked; console.log(this) });
- //$(target).toggleClass("list-group-item-success");
-
- });
-
-});
-
diff --git a/oer/exercise-formats/program/scriptgrade/script.js b/oer/exercise-formats/program/scriptgrade/script.js
new file mode 120000
index 0000000..d806bd6
--- /dev/null
+++ b/oer/exercise-formats/program/scriptgrade/script.js
@@ -0,0 +1 @@
+/data/oer/exercise-formats/program/match-regex/script.js
\ No newline at end of file
diff --git a/scripts/update-courses.sh b/scripts/update-courses.sh
index 97b325c..cec5292 100755
--- a/scripts/update-courses.sh
+++ b/scripts/update-courses.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/bash
+#!/bin/bash
source /data/run/virtualenv/bin/activate
cd /data/src
diff --git a/src/courses/views.py b/src/courses/views.py
index 67a9a16..1d0c87b 100644
--- a/src/courses/views.py
+++ b/src/courses/views.py
@@ -65,6 +65,8 @@ def section(request, cid, seid):
course = get_object_or_404(Course, pk=cid)
section = get_object_or_404(Section, pk=seid)
first_slide = section.slides.first()
+ #print(section.slides, file=sys.stderr)
+ #print(first_slide, file=sys.stderr)
if request.user.is_authenticated:
try:
@@ -97,8 +99,6 @@ def slide(request, cid, seid, slid):
section = get_object_or_404(Section, pk=seid)
slide = get_object_or_404(Slide, pk=slid)
-
-
if request.user.is_authenticated:
try:
user_course = UserCourse.objects.get(course=course, user=request.user)