Commit 51d9a5a5 by Dennis Jen

Merge pull request #70 from edx/dsjen/remove-milliseconds

Removed milliseconds from created date in problems endpoint.
parents eb085de4 fe085f5d
......@@ -604,13 +604,14 @@ class CourseProblemsListViewTests(DemoCourseMixin, TestCaseWithAuthentication):
alt_module_id = 'i4x://test/problem/2'
created = datetime.datetime.utcnow()
alt_created = created + datetime.timedelta(seconds=2)
date_time_format = '%Y-%m-%d %H:%M:%S'
o1 = G(models.ProblemResponseAnswerDistribution, course_id=self.course_id, module_id=module_id, correct=True,
count=100, created=created)
count=100, created=created.strftime(date_time_format))
o2 = G(models.ProblemResponseAnswerDistribution, course_id=self.course_id, module_id=alt_module_id,
correct=True, count=100, created=created)
correct=True, count=100, created=created.strftime(date_time_format))
o3 = G(models.ProblemResponseAnswerDistribution, course_id=self.course_id, module_id=module_id, correct=False,
count=200, created=alt_created)
count=200, created=alt_created.strftime(date_time_format))
expected = [
{
......
......@@ -661,6 +661,6 @@ GROUP BY module_id;
# Rather than write custom SQL for the SQLite backend, simply parse the timestamp.
created = row['created']
if not isinstance(created, datetime.datetime):
row['created'] = datetime.datetime.strptime(created, '%Y-%m-%d %H:%M:%S.%f')
row['created'] = datetime.datetime.strptime(created, '%Y-%m-%d %H:%M:%S')
return rows
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment