Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions inginious/frontend/webapp/pages/course_admin/task_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from collections import OrderedDict

import web
import yaml

from inginious.frontend.webapp.pages.course_admin.utils import make_csv, INGIniousAdminPage

Expand All @@ -23,6 +24,13 @@ def POST_AUTH(self, courseid): # pylint: disable=arguments-differ
course, _ = self.get_course_and_check_rights(courseid)
data = web.input(task=[])

if "new_task_id" in data:
# Create new task
default_task_data = yaml.safe_load(open("task.yaml", "r"))
default_task_data["name"] = data["new_task_id"]
self.task_factory.update_task_descriptor_content(courseid, data["new_task_id"], default_task_data, "yaml")


if "task" in data:
# Change tasks order
for index, taskid in enumerate(data["task"]):
Expand Down
11 changes: 7 additions & 4 deletions inginious/frontend/webapp/templates/course_admin/task_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ <h2>Tasks
</form>

<div class="row">
<div class="form-group">
<div class="col-sm-9"><input type="text" class="form-control" id="new_task_id" placeholder="New task id"/></div>
<div class="col-sm-3"><a href="javascript:studio_create_new_task();" class="btn btn-info btn-large btn-block">Create new task</a></div>
<form class="form-horizontal" method="post">
<div class="form-group">
<div class="col-sm-9"><input type="text" class="form-control" name="new_task_id" id="new_task_id" placeholder="New task id"/></div>
<div class="col-sm-3"><button type="submit" class="form-control btn btn-primary" value="Create new task"/>Create task</div>
</div>
</form>
</div>
</div>
$if len(errors) != 0:
Expand Down Expand Up @@ -117,4 +120,4 @@ <h3>Errors while loading tasks</h3>
}
$$('.sorted_table').sortable($$(this).hasClass("active") ? "enable" : "disable");
});
</script>
</script>
24 changes: 24 additions & 0 deletions task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
accessible: true
author: ''
context: ''
environment: mcq
evaluate: best
groups: false
limits:
output: '2'
memory: '100'
time: '30'
name: default
network_grading: false
problems:
default-task:
name: ''
type: code-multiple-languages
languages:
cpp11: true
header: ''
stored_submissions: 0
submission_limit:
amount: -1
period: -1
weight: 1.0