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
b7e795fa
Commit
b7e795fa
authored
May 01, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `max_attempt_reached` message type & update README
parent
a4d401bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
README.md
+11
-1
mentoring/mentoring.py
+7
-1
No files found.
README.md
View file @
b7e795fa
...
...
@@ -72,6 +72,9 @@ Second XBlock instance:
All is good now...
<html><p>
Congratulations!
</p></html>
</message>
<message
type=
"incomplete"
>
<html><p>
Still some work to do...
</p></html>
</message>
</mentoring>
```
...
...
@@ -95,6 +98,9 @@ Second XBlock instance:
All is good now...
<html><p>
Congratulations!
</p></html>
</message>
<message
type=
"incomplete"
>
<html><p>
Still some work to do...
</p></html>
</message>
</mentoring>
```
...
...
@@ -124,7 +130,8 @@ Second XBlock instance:
### Maximum Attempts
You can set the number of maximum attempts for the unit completion:
You can set the number of maximum attempts for the unit completion, as well as
a feedback message when the maximum number of attempts is reached:
```
xml
<mentoring
url_name=
"mcq_1"
enforce_dependency=
"false"
max_attempts=
"3"
>
<mrq
name=
"mrq_1_1"
type=
"choices"
hide_results=
"true"
>
...
...
@@ -136,6 +143,9 @@ You can set the number of maximum attempts for the unit completion:
All is good now...
<html><p>
Congratulations!
</p></html>
</message>
<message
type=
"max_attempts_reached"
>
<html><p>
Maximum number of attempts reached
</p></html>
</message>
</mentoring>
```
...
...
mentoring/mentoring.py
View file @
b7e795fa
...
...
@@ -143,11 +143,13 @@ class MentoringBlock(XBlockWithLightChildren):
completed
=
True
# server-side check to not set completion if the max_attempts is reached
if
self
.
max_attempts
>
0
and
self
.
num_attempts
>=
self
.
max_attempts
:
if
self
.
max_attempts
_reached
:
completed
=
False
if
completed
:
message
=
self
.
get_message_html
(
'completed'
)
elif
self
.
max_attempts_reached
:
message
=
self
.
get_message_html
(
'max_attempts_reached'
)
else
:
message
=
self
.
get_message_html
(
'incomplete'
)
...
...
@@ -180,6 +182,10 @@ class MentoringBlock(XBlockWithLightChildren):
'num_attempts'
:
self
.
num_attempts
}
@property
def
max_attempts_reached
(
self
):
return
self
.
max_attempts
>
0
and
self
.
num_attempts
>=
self
.
max_attempts
def
get_message_fragment
(
self
,
message_type
):
for
child
in
self
.
get_children_objects
():
if
isinstance
(
child
,
MentoringMessageBlock
)
and
child
.
type
==
message_type
:
...
...
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