open-contracting / credere-backend

A tool that facilitates the participation of Micro, Small, and Medium businesses (MSMEs) in the Colombian public procurement market.
https://credere.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Why add a second to from_date in get_new_awards? #313

Closed jpmckinney closed 1 month ago

jpmckinney commented 1 month ago

I also noticed we advance the from_date by one second, but only if the until_date is not provided. Why do we advance the from_date at all? And if there is a reason, why not advance it when until_date is set?

(In c4ae0fb794a9ce0903f17d7c04b83e7f42553b80, it changed from subtracting 1 day to adding 1 second. At the same time, it changed the date format from forcing a time component of 00:00:00, to honoring the time component of the input datetime. I assume 1 day was subtracted to begin with in 3f308dea8e1ed38e21bf59c6e1ef43d7c18f4a79, because that made some sense in the context of forcing the time component to 00:00:00)

yolile commented 1 month ago

from_date and until_date are only set when the command fetch_all_awards_from_period is called manually, with two fixed dates (without time), so we don't need to do anything with the dates provided by the CLI user.

If only from_date is set (or is not set, for example when there are no awards in the database), then we add one second to make sure we are not requesting the same awards again, as the date filter condition is >=. We could perhaps stop adding one second and change the condition to > instead.

There is not a case when only a until_date will be provided, and if so, the util_date value will be ignored, and only the default from_date (defined by app_settings.secop_default_days_from_ultima_actualizacion) will be used.

jpmckinney commented 1 month ago

Okay, I’ll reopen to add a comment to the code on Monday.