Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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
edx
edx-ora2
Commits
0b1d01ae
Commit
0b1d01ae
authored
Mar 25, 2014
by
Stephen Sanchez
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #188 from edx/sanchez/TIM-326-Due-Dates
Adding datetime displays to assessment modules
parents
694a0a7b
5db4f40b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
6 deletions
+51
-6
apps/openassessment/templates/openassessmentblock/peer/oa_peer_assessment.html
+8
-1
apps/openassessment/templates/openassessmentblock/self/oa_self_assessment.html
+8
-1
apps/openassessment/xblock/openassessmentblock.py
+26
-4
apps/openassessment/xblock/peer_assessment_mixin.py
+3
-0
apps/openassessment/xblock/self_assessment_mixin.py
+6
-0
No files found.
apps/openassessment/templates/openassessmentblock/peer/oa_peer_assessment.html
View file @
0b1d01ae
...
@@ -11,7 +11,14 @@
...
@@ -11,7 +11,14 @@
<span
class=
"step__counter"
></span>
<span
class=
"step__counter"
></span>
<span
class=
"wrapper--copy"
>
<span
class=
"wrapper--copy"
>
<span
class=
"step__label"
>
Assess Peers
</span>
<span
class=
"step__label"
>
Assess Peers
</span>
<span
class=
"step__deadline"
>
due
<span
class=
"date"
>
{{ formatted_due_datetime }}
</span></span>
{% if peer_due %}
<span
class=
"step__deadline"
>
due
<span
class=
"date"
>
{{ peer_due }}
(in {{ peer_due|timeuntil }})
</span>
</span>
{% endif %}
</span>
</span>
</h2>
</h2>
...
...
apps/openassessment/templates/openassessmentblock/self/oa_self_assessment.html
View file @
0b1d01ae
...
@@ -12,7 +12,14 @@
...
@@ -12,7 +12,14 @@
<span
class=
"step__counter"
></span>
<span
class=
"step__counter"
></span>
<span
class=
"wrapper--copy"
>
<span
class=
"wrapper--copy"
>
<span
class=
"step__label"
>
Assess Yourself
</span>
<span
class=
"step__label"
>
Assess Yourself
</span>
<span
class=
"step__deadline"
>
due
<span
class=
"date"
>
{{ formatted_due_datetime }}
</span></span>
{% if self_due %}
<span
class=
"step__deadline"
>
due
<span
class=
"date"
>
{{ self_due }}
(in {{ self_due|timeuntil }})
</span>
</span>
{% endif %}
</span>
</span>
</h2>
</h2>
...
...
apps/openassessment/xblock/openassessmentblock.py
View file @
0b1d01ae
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
datetime
as
dt
import
datetime
as
dt
import
logging
import
logging
import
dateutil
import
pkg_resources
import
pkg_resources
import
pytz
import
pytz
...
@@ -155,6 +156,9 @@ DEFAULT_ASSESSMENT_MODULES = [
...
@@ -155,6 +156,9 @@ DEFAULT_ASSESSMENT_MODULES = [
DEFAULT_SELF_ASSESSMENT
,
DEFAULT_SELF_ASSESSMENT
,
]
]
DATE_FORMAT
=
"
%
A,
%
B
%
d,
%
Y"
DATETIME_FORMAT
=
"
%
A,
%
B
%
d,
%
Y
%
X"
def
load
(
path
):
def
load
(
path
):
"""Handy helper for getting resources from our kit."""
"""Handy helper for getting resources from our kit."""
...
@@ -366,16 +370,34 @@ class OpenAssessmentBlock(
...
@@ -366,16 +370,34 @@ class OpenAssessmentBlock(
context_dict
=
{}
context_dict
=
{}
if
self
.
start
:
if
self
.
start
:
context_dict
[
"formatted_start_date"
]
=
self
.
start
.
strftime
(
"
%
A,
%
B
%
d,
%
Y"
)
context_dict
[
"formatted_start_date"
]
=
self
.
start
.
strftime
(
DATE_FORMAT
)
context_dict
[
"formatted_start_datetime"
]
=
self
.
start
.
strftime
(
"
%
A,
%
B
%
d,
%
Y
%
X"
)
context_dict
[
"formatted_start_datetime"
]
=
self
.
start
.
strftime
(
DATETIME_FORMAT
)
if
self
.
due
:
if
self
.
due
:
context_dict
[
"formatted_due_date"
]
=
self
.
due
.
strftime
(
"
%
A,
%
B
%
d,
%
Y"
)
context_dict
[
"formatted_due_date"
]
=
self
.
due
.
strftime
(
DATE_FORMAT
)
context_dict
[
"formatted_due_datetime"
]
=
self
.
due
.
strftime
(
"
%
A,
%
B
%
d,
%
Y
%
X"
)
context_dict
[
"formatted_due_datetime"
]
=
self
.
due
.
strftime
(
DATETIME_FORMAT
)
template
=
get_template
(
path
)
template
=
get_template
(
path
)
context
=
Context
(
context_dict
)
context
=
Context
(
context_dict
)
return
Response
(
template
.
render
(
context
),
content_type
=
'application/html'
,
charset
=
'UTF-8'
)
return
Response
(
template
.
render
(
context
),
content_type
=
'application/html'
,
charset
=
'UTF-8'
)
def
format_datetime_string
(
self
,
datetime_str
):
"""Takes a datetime string, and formats it to be a user facing time.
Format a datetime string to be user facing. Datetimes are stored as
strings in the XBlock configuration for an assessment module. This
function is used to get back the Datetime object for rendering the start
and due dates on the front end.
Args:
datetime_str (str): A ISO formatted Datetime String, to be converted
to a datetime object with UTC timezone.
Returns:
datetime with UTC timezone from the given string.
"""
return
dateutil
.
parser
.
parse
(
unicode
(
datetime_str
))
.
replace
(
tzinfo
=
pytz
.
utc
)
def
add_xml_to_node
(
self
,
node
):
def
add_xml_to_node
(
self
,
node
):
"""
"""
Serialize the XBlock to XML for exporting.
Serialize the XBlock to XML for exporting.
...
...
apps/openassessment/xblock/peer_assessment_mixin.py
View file @
0b1d01ae
...
@@ -149,6 +149,9 @@ class PeerAssessmentMixin(object):
...
@@ -149,6 +149,9 @@ class PeerAssessmentMixin(object):
context_dict
[
"submit_button_text"
]
=
(
context_dict
[
"submit_button_text"
]
=
(
"Submit your assessment & move to response #{}"
"Submit your assessment & move to response #{}"
)
.
format
(
count
+
2
)
)
.
format
(
count
+
2
)
if
assessment
.
get
(
'due'
):
context_dict
[
"peer_due"
]
=
self
.
format_datetime_string
(
assessment
[
"due"
])
if
date
==
"due"
and
not
problem_open
:
if
date
==
"due"
and
not
problem_open
:
path
=
'openassessmentblock/peer/oa_peer_closed.html'
path
=
'openassessmentblock/peer/oa_peer_closed.html'
...
...
apps/openassessment/xblock/self_assessment_mixin.py
View file @
0b1d01ae
...
@@ -24,11 +24,17 @@ class SelfAssessmentMixin(object):
...
@@ -24,11 +24,17 @@ class SelfAssessmentMixin(object):
@XBlock.handler
@XBlock.handler
def
render_self_assessment
(
self
,
data
,
suffix
=
''
):
def
render_self_assessment
(
self
,
data
,
suffix
=
''
):
context
=
{}
context
=
{}
assessment_module
=
self
.
get_assessment_module
(
'self-assessment'
)
if
assessment_module
and
assessment_module
.
get
(
'due'
):
context
[
"self_due"
]
=
self
.
format_datetime_string
(
assessment_module
[
"due"
])
path
=
'openassessmentblock/self/oa_self_unavailable.html'
path
=
'openassessmentblock/self/oa_self_unavailable.html'
problem_open
,
date
=
self
.
is_open
(
step
=
"self"
)
problem_open
,
date
=
self
.
is_open
(
step
=
"self"
)
workflow
=
self
.
get_workflow_info
()
workflow
=
self
.
get_workflow_info
()
if
not
workflow
:
if
not
workflow
:
return
self
.
render_assessment
(
path
,
context
)
return
self
.
render_assessment
(
path
,
context
)
try
:
try
:
submission
=
submission_api
.
get_submission
(
self
.
submission_uuid
)
submission
=
submission_api
.
get_submission
(
self
.
submission_uuid
)
assessment
=
self_api
.
get_assessment
(
assessment
=
self_api
.
get_assessment
(
...
...
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