annotationsatharvard / catcha

Catch-A - Catching Annotation: An annotation backend and API.
http://catcha.readthedocs.io
20 stars 9 forks source link

API returns the incorrect time on date created / last updated by 12 hours #65

Closed jmiranda closed 9 years ago

jmiranda commented 9 years ago

On May 11 Luis reported the following issue:

I made a test annotation and it returned the incorrect time by 12 hours. I'm assuming this is a 12-hr vs 24hr clock issue. Can you verify whether I did something wrong or whether there's something off about the server time?

For example, I made an annotation at 5:08pm my time. The date/time on the network call says: "2015-05-11T09:08:55.0+0000 And while it is true that I'm at -4 hours from GMT, that would mean the time it thinks it is is 05:08am.

jmiranda commented 9 years ago

Here's what I found ...

Server timezone is UTC.

ubuntu@ip-172-31-40-181:~$ date
Tue May 12 15:45:12 UTC 2015

The date in the database looks fine.

mysql> select id, uri, date_created, last_updated from annotation order by last_updated desc limit 10;
+--------+-----------------------------------------------------------------------------------------------------------------+---------------------+---------------------+
| id     | uri                                                                                                             | date_created        | last_updated        |
+--------+-----------------------------------------------------------------------------------------------------------------+---------------------+---------------------+
| 120852 | 1_Summer/BMo101/2013_Spring_2                                                                                   | 2015-05-11 21:04:38 | 2015-05-11 21:04:38 |
| 120851 | 1_Summer/BMo101/2013_Spring_2                                                                                   | 2015-05-11 20:43:07 | 2015-05-11 20:43:33 |
| 120847 | 1_Summer/BMo101/2013_Spring_2                                                                                   | 2015-05-11 19:19:47 | 2015-05-11 20:42:44 |
| 120850 | http://oculus-dev.harvardx.harvard.edu/manifests/drs:5981093/canvas/canvas-5981102.json:TLT/TLT101/2014_T4:None | 2015-05-11 20:19:38 | 2015-05-11 20:19:38 |
| 120849 | http://oculus-dev.harvardx.harvard.edu/manifests/drs:5981093/canvas/canvas-5981102.json:TLT/TLT101/2014_T4:None | 2015-05-11 20:05:11 | 2015-05-11 20:05:11 |
| 120837 | 1_Summer/BMo101/2013_Spring_2                                                                                   | 2015-05-08 15:59:46 | 2015-05-11 19:31:57 |
| 120848 | http://oculus-dev.harvardx.harvard.edu/manifests/drs:5981093/canvas/canvas-5981102.json                         | 2015-05-11 19:31:19 | 2015-05-11 19:31:19 |
| 120831 | 1_Summer/BMo101/2013_Spring_2                                                                                   | 2015-05-06 21:14:16 | 2015-05-11 16:07:21 |
| 120830 | 1_Summer/BMo101/2013_Spring_2                                                                                   | 2015-05-06 20:12:52 | 2015-05-11 16:06:13 |
| 120845 | http://data.ucd.ie/api/img/manifests/ivrla:10795/canvas/ivrla:10795.json                                        | 2015-05-09 22:13:55 | 2015-05-09 22:13:55 |
+--------+-----------------------------------------------------------------------------------------------------------------+---------------------+---------------------+
10 rows in set (0.81 sec)

The date returned with the JSON response does not look ok. As you suggested, I bet the date format used in the code is using hh (12-hour format) instead of HH (24-hour format). I will investigate that and get back to you, but just know that the actual dates in the database are probably fine.

2015-05-11 21:04:38,167 [http-bio-8080-exec-14] INFO  httplogger.DefaultHttpLogger  - << #327 POST http://catch-dev.harvardx.harvard.edu:8080/catch/annotator/create
2015-05-11 21:04:38,167 [http-bio-8080-exec-14] INFO  httplogger.DefaultHttpLogger  - << #327 body: '{"permissions":{"read":[],"update":["76e9c54d06a28717a837ea77946015d8"],"delete":["76e9c54d06a28717a837ea77946015d8"],"admin":["76e9c54d06a28717a837ea77946015d8"]},"user":{"id":"76e9c54d06a28717a837ea77946015d8","name":"lduarte1991"},"ranges":[{"start":"/p[1]","startOffset":91,"end":"/p[1]","endOffset":97}],"quote":"me sto","text":"<p>kjnlkj</p>","tags":[""],"uri":"1_Summer/BMo101/2013_Spring_2","citation":"fake source","media":"text"}'
2015-05-11 21:04:38,314 [http-bio-8080-exec-14] INFO  persistence.Annotation  - Converting json={"tags":[""],"citation":"fake source","text":"<p>kjnlkj<\/p>","quote":"me sto","ranges":[{"endOffset":97,"start":"/p[1]","end":"/p[1]","startOffset":91}],"permissions":{"update":["76e9c54d06a28717a837ea77946015d8"],"admin":["76e9c54d06a28717a837ea77946015d8"],"delete":["76e9c54d06a28717a837ea77946015d8"],"read":[]},"media":"text","uri":"1_Summer/BMo101/2013_Spring_2","user":{"id":"76e9c54d06a28717a837ea77946015d8","name":"lduarte1991"}} to jsonObject=[tags:[], citation:fake source, text:<p>kjnlkj</p>, totalComments:0, ranges:[[endOffset:97, start:/p[1], end:/p[1], startOffset:91]], deleted:false, uri:1_Summer/BMo101/2013_Spring_2, id:120852, archived:false, updated:2015-05-11T09:04:38.224+0000, created:2015-05-11T09:04:38.224+0000, quote:me sto, permissions:[update:[76e9c54d06a28717a837ea77946015d8], admin:[76e9c54d06a28717a837ea77946015d8], delete:[76e9c54d06a28717a837ea77946015d8], read:[]], media:text, user:[id:76e9c54d06a28717a837ea77946015d8, name:lduarte1991]]
2015-05-11 21:04:38,317 [http-bio-8080-exec-14] INFO  httplogger.DefaultHttpLogger  - >> #327 returned 200, took 151 ms.
2015-05-11 21:04:38,317 [http-bio-8080-exec-14] INFO  httplogger.DefaultHttpLogger  - >> #327 responded with '{"tags":[""],"citation":"fake source","text":"<p>kjnlkj<\/p>","totalComments":0,"ranges":[{"endOffset":97,"start":"/p[1]","end":"/p[1]","startOffset":91}],"deleted":false,"uri":"1_Summer/BMo101/2013_Spring_2","id":120852,"archived":false,"updated":"2015-05-11T09:04:38.224+0000","created":"2015-05-11T09:04:38.224+0000","quote":"me sto","permissions":{"update":["76e9c54d06a28717a837ea77946015d8"],"admin":["76e9c54d06a28717a837ea77946015d8"],"delete":["76e9c54d06a28717a837ea77946015d8"],"read":[]},"media":"text","user":{"id":"76e9c54d06a28717a837ea77946015d8","name":"lduarte1991"}}'