Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix order of subproblems #1011

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion inginious/frontend/pages/taskset_admin/task_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def GET_AUTH(self, tasksetid, taskid): # pylint: disable=arguments-differ
environment_types = self.environment_types
environments = self.environments

problemdata = [(id, dict(item)) for id, item in list(task_data.get('problems', {}).items())] # odict to tuple list

current_filetype = None
try:
current_filetype = self.task_factory.get_task_descriptor_extension(taskset.get_id(), taskid)
Expand All @@ -59,7 +61,7 @@ def GET_AUTH(self, tasksetid, taskid): # pylint: disable=arguments-differ
return self.template_helper.render("taskset_admin/task_edit.html", taskset=taskset, taskid=taskid,
problem_types=self.task_factory.get_problem_types(), task_data=task_data,
environment_types=environment_types, environments=environments,
problemdata=json.dumps(task_data.get('problems', {})),
problemdata=problemdata,
contains_is_html=self.contains_is_html(task_data),
current_filetype=current_filetype,
available_filetypes=available_filetypes,
Expand Down
7 changes: 3 additions & 4 deletions inginious/frontend/static/js/studio.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regenerate minified js

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ function refresh_codemirror()
* Load the studio, creating blocks for existing subproblems
*/
function studio_load(data)
{
jQuery.each(data, function(pid, problem)
{
{
data.forEach(([pid, problem]) => {
var template = "#subproblem_" + problem["type"];
studio_create_from_template(template, pid);
studio_init_template(pid, problem);
Expand Down Expand Up @@ -334,7 +333,7 @@ function studio_create_new_subproblem()
var new_subproblem_type = $('#new_subproblem_type').val();
if(!new_subproblem_pid.match(/^[a-zA-Z0-9_\-]+$/))
{
alert('Problem id should only contain alphanumeric characters (in addition to "_" and "-").');
alert('Invalid problem id. It should only contain alphanumeric characters (in addition to "_" and "-") and shouldn\'t be empty.');
return;
}

Expand Down
3 changes: 1 addition & 2 deletions inginious/frontend/templates/taskset_admin/task_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ <h2>
<!-- Init the javascript for the subproblem tab -->
<script type="text/javascript">
delete_subproblem_message = '{{_("Are you sure that you want to delete this subproblem?")}}';
problem_data = {{ problemdata | tojson }};
$(function(){ studio_load(JSON.parse(problem_data)); });
$(function(){ studio_load({{ problemdata | tojson }}); });
</script>

{% endblock %}
Loading