asiripanich / emdash

An e-mission deployer's dashboard. See https://github.com/e-mission/e-mission-docs.
https://emdash.amarin.dev
Other
6 stars 3 forks source link

Fix bike check in delete #58

Closed allenmichael099 closed 3 years ago

allenmichael099 commented 3 years ago

Switched to object ID to identify which Checkinout entry to delete. It used to use user_id, but that did not delete database entries because it was not converted to BSON before querying. I couldn't find a way to convert it to BSON or a way to query with BSON in mongolite.

allenmichael099 commented 3 years ago

@shankari @asiripanich As far as I can tell, this is now ready to go. Checkinout objects get deleted based on objectId, and the formatted time still displays correctly.

If in future edits to this feature you find the problem below, it is probably because the target indices within columnDefs got shifted out of place. Error_no_bike_data

asiripanich commented 3 years ago

this feature you find the problem below, it is probably because the target indices

I personally don't like this workaround. Maybe DTedit is a bad choice to begin with. However, I'm going to merge it to allow this feature to exist. But it will most likely be removed when I do a major update to the dashboard.

shankari commented 3 years ago

@asiripanich I don't know that the problem is with DTedit; the problem is with making the call to the database to delete the entry. We will have to solve something similar for the user status editing anyway.

asiripanich commented 3 years ago

@allenmichael099 could you please explain why you need this? I know it is not part of this PR but seems related to this.

https://github.com/asiripanich/emdash/blob/e44b82c3be282d22e2ca0e11966116533c568028/R/app_server.R#L202-L217

allenmichael099 commented 3 years ago

@asiripanich The code snippet above is so we will render a human readable time next to the timestamp every time a supplementary table has a column called 'ts'.

asiripanich commented 3 years ago

@asiripanich The code snippet above is so we will render a human readable time next to the timestamp every time a supplementary table has a column called 'ts'.

Can we convert this timestamp to a proper datetime field during the 'load data' step?

shankari commented 3 years ago

@asiripanich we tried using datetime, but since the conversion happens in R, it converts based on the timezone of the server, which for AWS is UTC. So instead of the user seeing the datetime in their local timezone, they will see it in UTC, and have to do the conversion in their head.

With this option, we convert the timestamp on the browser instead.