OH-SHOWN/ohshown-frontend

`datetime` value is not expected from the frontend when parsing in the backend

Closed this issue · 2 comments

Describe the bug
When reporting the ohshown event, it seems the 遭遇時間 is incorrect when it is posted to the API of backend. The value of datetime seems the same as created time.

To Reproduce

  1. Use the backend source of this pull request OH-SHOWN/ohshown-backend#59
  2. Report ohshown event as usual. Make sure you have selected a time value differing from the current time in the "calendar and clock" (see the attached image)
  3. Go to the Django admin console of backend. Go to api/ohshown event
  4. Check the column of "sight see date time". Check the value of your ohshown event entry.

Expected behavior
The value of "calendar and clock" we selected is the same as the value of the field "sight see date time" in the django admin console.

Screenshots
The "calendar and clock"
Selection_051

The "sight see date time` column:
Selection_050

Additional context
I am not entirely sure it is a bug of the fontend. This issue may be also my fault from this pull request OH-SHOWN/ohshown-backend#59 . I created this issue because I did not manage to see the root cause in the pull request OH-SHOWN/ohshown-backend#59 . For example, I simply get the datetime value from the frontend. See here https://github.com/OH-SHOWN/ohshown-backend/pull/59/files#r857158945 .

My testing showed that the front-end form returned correct sight-see-date-time value in post data field "datetime". The mentioned bug seems weird, maybe it's not a bug from the front-end.

截圖 2022-05-04 下午10 49 41

By the way, I found the "reported-date" called "date", "reported-time" called "time", "sight-see-date-time" called "datetime" in post data, these are ambiguous and misleading naming, sorry for that.

I'll fix the post data naming in the following days.

OH-SHOWN/ohshown-backend#59 is landed and fixed this issue.