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
2e173645
Commit
2e173645
authored
Mar 22, 2016
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix oa_block release state status
parent
120155f0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
2 deletions
+24
-2
AUTHORS
+1
-0
openassessment/xblock/openassessmentblock.py
+5
-2
openassessment/xblock/resolve_dates.py
+5
-0
openassessment/xblock/test/test_openassessment.py
+13
-0
No files found.
AUTHORS
View file @
2e173645
...
@@ -24,3 +24,4 @@ Pan Luo <pan.luo@ubc.ca>
...
@@ -24,3 +24,4 @@ Pan Luo <pan.luo@ubc.ca>
Eric Fischer <efischer@edx.org>
Eric Fischer <efischer@edx.org>
Andy Armstrong <andya@edx.org>
Andy Armstrong <andya@edx.org>
Christina Roberts <christina@edx.org>
Christina Roberts <christina@edx.org>
Mushtaq Ali <mushtaak@gmail.com>
openassessment/xblock/openassessmentblock.py
View file @
2e173645
...
@@ -35,7 +35,7 @@ from openassessment.xblock.staff_assessment_mixin import StaffAssessmentMixin
...
@@ -35,7 +35,7 @@ from openassessment.xblock.staff_assessment_mixin import StaffAssessmentMixin
from
openassessment.workflow.errors
import
AssessmentWorkflowError
from
openassessment.workflow.errors
import
AssessmentWorkflowError
from
openassessment.xblock.student_training_mixin
import
StudentTrainingMixin
from
openassessment.xblock.student_training_mixin
import
StudentTrainingMixin
from
openassessment.xblock.validation
import
validator
from
openassessment.xblock.validation
import
validator
from
openassessment.xblock.resolve_dates
import
resolve_dates
,
DISTANT_PAST
,
DISTANT_FUTURE
from
openassessment.xblock.resolve_dates
import
resolve_dates
,
parse_date_value
,
DISTANT_PAST
,
DISTANT_FUTURE
from
openassessment.xblock.data_conversion
import
create_prompts_list
,
create_rubric_dict
,
update_assessments_format
from
openassessment.xblock.data_conversion
import
create_prompts_list
,
create_rubric_dict
,
update_assessments_format
...
@@ -834,7 +834,10 @@ class OpenAssessmentBlock(
...
@@ -834,7 +834,10 @@ class OpenAssessmentBlock(
else
:
else
:
is_published
=
True
is_published
=
True
is_closed
,
reason
,
__
,
__
=
self
.
is_closed
(
step
=
step
)
is_closed
,
reason
,
__
,
__
=
self
.
is_closed
(
step
=
step
)
return
is_published
and
(
not
is_closed
or
reason
==
'due'
)
is_released
=
is_published
and
(
not
is_closed
or
reason
==
'due'
)
if
self
.
start
:
is_released
=
is_released
and
dt
.
datetime
.
now
(
pytz
.
UTC
)
>
parse_date_value
(
self
.
start
,
self
.
_
)
return
is_released
def
get_assessment_module
(
self
,
mixin_name
):
def
get_assessment_module
(
self
,
mixin_name
):
"""
"""
...
...
openassessment/xblock/resolve_dates.py
View file @
2e173645
...
@@ -52,6 +52,11 @@ def _parse_date(value, _):
...
@@ -52,6 +52,11 @@ def _parse_date(value, _):
raise
InvalidDateFormat
(
_
(
"'{date}' must be a date string or datetime"
)
.
format
(
date
=
value
))
raise
InvalidDateFormat
(
_
(
"'{date}' must be a date string or datetime"
)
.
format
(
date
=
value
))
def
parse_date_value
(
date
,
_
):
""" Public method for _parse_date """
return
_parse_date
(
date
,
_
)
def
resolve_dates
(
start
,
end
,
date_ranges
,
_
):
def
resolve_dates
(
start
,
end
,
date_ranges
,
_
):
"""
"""
Resolve date strings (including "default" dates) to datetimes.
Resolve date strings (including "default" dates) to datetimes.
...
...
openassessment/xblock/test/test_openassessment.py
View file @
2e173645
...
@@ -499,6 +499,19 @@ class TestDates(XBlockHandlerTestCase):
...
@@ -499,6 +499,19 @@ class TestDates(XBlockHandlerTestCase):
self
.
assertTrue
(
xblock
.
is_released
())
self
.
assertTrue
(
xblock
.
is_released
())
@scenario
(
'data/basic_scenario.xml'
)
@scenario
(
'data/basic_scenario.xml'
)
def
test_is_released_published_scheduled
(
self
,
xblock
):
# The scenario doesn't provide a start date, so `is_released()`
# should be controlled only by the published state which defaults to True
xblock
.
runtime
.
modulestore
=
MagicMock
()
xblock
.
runtime
.
modulestore
.
has_published_version
.
return_value
=
True
# Set the start date one day ahead in the future (in UTC)
xblock
.
start
=
dt
.
datetime
.
utcnow
()
.
replace
(
tzinfo
=
pytz
.
utc
)
+
dt
.
timedelta
(
days
=
1
)
# Check that it is not yet released
self
.
assertFalse
(
xblock
.
is_released
())
@scenario
(
'data/basic_scenario.xml'
)
def
test_is_released_no_ms
(
self
,
xblock
):
def
test_is_released_no_ms
(
self
,
xblock
):
self
.
assertTrue
(
xblock
.
is_released
())
self
.
assertTrue
(
xblock
.
is_released
())
...
...
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