Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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-platform
Commits
11dce770
Commit
11dce770
authored
Mar 01, 2017
by
sanfordstudent
Committed by
GitHub
Mar 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14608 from edx/sstudent/utc_modified_times
ensure that modified start/end are treated as UTC by django
parents
090fc12b
576516b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
lms/djangoapps/grades/management/commands/reset_grades.py
+5
-4
No files found.
lms/djangoapps/grades/management/commands/reset_grades.py
View file @
11dce770
...
...
@@ -3,6 +3,7 @@ Reset persistent grades for learners.
"""
from
datetime
import
datetime
import
logging
from
pytz
import
utc
from
textwrap
import
dedent
from
django.core.management.base
import
BaseCommand
,
CommandError
...
...
@@ -58,12 +59,12 @@ class Command(BaseCommand):
parser
.
add_argument
(
'--modified_start'
,
dest
=
'modified_start'
,
help
=
'Starting range for modified date (inclusive): e.g. "2016-08-23 16:43"'
,
help
=
'Starting range for modified date (inclusive): e.g. "2016-08-23 16:43"
; expected in UTC.
'
,
)
parser
.
add_argument
(
'--modified_end'
,
dest
=
'modified_end'
,
help
=
'Ending range for modified date (inclusive): e.g. "2016-12-23 16:43"'
,
help
=
'Ending range for modified date (inclusive): e.g. "2016-12-23 16:43"
; expected in UTC.
'
,
)
parser
.
add_argument
(
'--db_table'
,
...
...
@@ -84,12 +85,12 @@ class Command(BaseCommand):
raise
CommandError
(
'Invalid value for db_table. Valid options are "subsection" or "course" only.'
)
if
options
.
get
(
'modified_start'
):
modified_start
=
datetime
.
strptime
(
options
[
'modified_start'
],
DATE_FORMAT
)
modified_start
=
utc
.
localize
(
datetime
.
strptime
(
options
[
'modified_start'
],
DATE_FORMAT
)
)
if
options
.
get
(
'modified_end'
):
if
not
modified_start
:
raise
CommandError
(
'Optional value for modified_end provided without a value for modified_start.'
)
modified_end
=
datetime
.
strptime
(
options
[
'modified_end'
],
DATE_FORMAT
)
modified_end
=
utc
.
localize
(
datetime
.
strptime
(
options
[
'modified_end'
],
DATE_FORMAT
)
)
if
courses_mode
==
'courses'
:
course_keys
=
parse_course_keys
(
options
[
'courses'
])
...
...
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