hotosm / galaxy-api

Backend to fetch data from Underpass
https://galaxy-api.hotosm.org/latest/redoc
GNU Affero General Public License v3.0
14 stars 5 forks source link

Fixed time difference from 30 days to month validation : User stats #238

Closed kshitijrajsharma closed 2 years ago

kshitijrajsharma commented 2 years ago

Uses python relativedelta util , Details can be found here

Testing param to osm-users/statistics

{"userId":752045,"fromTimestamp":"2022-05-01T00:00:00Z","toTimestamp":"2022-05-31T11:59:00Z","projectIds":[],"hashtags":[]}

Expected result : Validation for Above parameter should pass with current fix

RAytoun commented 2 years ago

Thank you Kshitij and the team

ramyaragupathy commented 2 years ago

@itskshitiz321 - thanks for the prompt response 🙏 - does this delta treats 31 days as the accepted time difference for the input time stamps?

cc @d-rita

kshitijrajsharma commented 2 years ago

Yes it will check how many days are there in between and it will treat based on the no of days in a respective month , for example for may in 2022 it will validate 31 days and for current month (June ) it will validate 30 days @ramyaragupathy

d-rita commented 2 years ago

If a person queries mid-month, say from 15th May to 15th June, what will be the accepted range of days: 30 or 31 days? @itskshitiz321

kshitijrajsharma commented 2 years ago

@d-rita It will be based on the no of days in first month during querying if user queries from 15th of may then validation will be of 31 days since may ended on 31