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
461faebe
Commit
461faebe
authored
Apr 01, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display student and course name in the report
parent
fe5e9db7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
mentoring/dashboard.py
+22
-0
mentoring/templates/html/dashboard_report.html
+6
-0
No files found.
mentoring/dashboard.py
View file @
461faebe
...
@@ -154,6 +154,7 @@ class InvalidUrlName(ValueError):
...
@@ -154,6 +154,7 @@ class InvalidUrlName(ValueError):
@XBlock.needs
(
"i18n"
)
@XBlock.needs
(
"i18n"
)
@XBlock.wants
(
"user"
)
class
DashboardBlock
(
StudioEditableXBlockMixin
,
XBlock
):
class
DashboardBlock
(
StudioEditableXBlockMixin
,
XBlock
):
"""
"""
A block to summarize self-assessment results.
A block to summarize self-assessment results.
...
@@ -277,6 +278,25 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -277,6 +278,25 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
return
rule
.
color_str
return
rule
.
color_str
return
None
return
None
def
_get_user_full_name
(
self
):
"""
Get the full name of the current user, for the downloadable report.
"""
user_service
=
self
.
runtime
.
service
(
self
,
'user'
)
if
user_service
:
return
user_service
.
get_current_user
()
.
full_name
return
""
def
_get_course_name
(
self
):
"""
Get the name of the current course, for the downloadable report.
"""
try
:
course_root_key
=
self
.
scope_ids
.
usage_id
.
course_key
.
make_usage_key
(
'course'
,
'course'
)
return
self
.
runtime
.
get_block
(
course_root_key
)
.
display_name
except
Exception
:
# AttributeErrror, XBLockNotFoundError, ItemNotFoundError, ...
return
""
def
generate_content
(
self
,
include_report_link
=
True
):
def
generate_content
(
self
,
include_report_link
=
True
):
"""
"""
Create the HTML for this block, by getting the data and inserting it into a template.
Create the HTML for this block, by getting the data and inserting it into a template.
...
@@ -350,6 +370,8 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
...
@@ -350,6 +370,8 @@ class DashboardBlock(StudioEditableXBlockMixin, XBlock):
'title'
:
self
.
display_name
,
'title'
:
self
.
display_name
,
'body'
:
self
.
generate_content
(
include_report_link
=
False
),
'body'
:
self
.
generate_content
(
include_report_link
=
False
),
'css'
:
loader
.
load_unicode
(
self
.
css_path
),
'css'
:
loader
.
load_unicode
(
self
.
css_path
),
'student_name'
:
self
.
_get_user_full_name
(),
'course_name'
:
self
.
_get_course_name
(),
})
})
return
Response
(
return
Response
(
report_html
,
report_html
,
...
...
mentoring/templates/html/dashboard_report.html
View file @
461faebe
{% load i18n %}
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
...
@@ -12,6 +13,11 @@
...
@@ -12,6 +13,11 @@
</style>
</style>
</head>
</head>
<body>
<body>
<div>
{% if student_name %}{% trans "Student" %}: {{student_name}}
<br>
{% endif %}
{% if course_name %}{% trans "Course" %}: {{course_name}}
<br>
{% endif %}
{% trans "Date" %}: {% now "DATE_FORMAT" %}
<br>
</div>
{{body}}
{{body}}
</body>
</body>
</html>
</html>
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