Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
problem-builder
Commits
677ffef8
Commit
677ffef8
authored
Sep 23, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update num_attempts field of new mentoring block after submitting last step.
parent
839840a3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
problem_builder/mentoring.py
+5
-0
problem_builder/public/js/mentoring_with_steps.js
+8
-0
problem_builder/step.py
+6
-0
No files found.
problem_builder/mentoring.py
View file @
677ffef8
...
...
@@ -976,6 +976,11 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
}
@XBlock.json_handler
def
update_num_attempts
(
self
,
data
,
suffix
=
''
):
self
.
num_attempts
+=
1
return
{}
@XBlock.json_handler
def
try_again
(
self
,
data
,
suffix
=
''
):
self
.
active_step
=
0
...
...
problem_builder/public/js/mentoring_with_steps.js
View file @
677ffef8
...
...
@@ -26,9 +26,17 @@ function MentoringWithStepsBlock(runtime, element) {
});
}
function
updateNumAttempts
()
{
var
handlerUrl
=
runtime
.
handlerUrl
(
element
,
'update_num_attempts'
);
$
.
post
(
handlerUrl
,
JSON
.
stringify
({}));
}
function
handleResults
(
response
)
{
// Update active step so next step is shown on page reload (even if user does not click "Next Step")
updateActiveStep
(
activeStep
+
1
);
if
(
response
.
update_attempts
)
{
updateNumAttempts
();
}
// Update UI
if
(
response
.
completed
===
'correct'
)
{
...
...
problem_builder/step.py
View file @
677ffef8
...
...
@@ -103,6 +103,11 @@ class MentoringStepBlock(
return
self
.
get_parent
()
.
steps
@property
def
is_last_step
(
self
):
parent
=
self
.
get_parent
()
return
self
.
step_number
==
len
(
parent
.
steps
)
@property
def
allowed_nested_blocks
(
self
):
"""
Returns a list of allowed nested XBlocks. Each item can be either
...
...
@@ -149,6 +154,7 @@ class MentoringStepBlock(
'message'
:
'Success!'
,
'completed'
:
completed
,
'results'
:
submit_results
,
'update_attempts'
:
self
.
is_last_step
}
def
reset
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment