dronefly-garden / dronefly

Red Discord Bot V3 cogs for naturalists.
Other
16 stars 3 forks source link

obs (grammar): support today and yesterday #112

Closed michaelpirrello closed 3 years ago

michaelpirrello commented 4 years ago

I would like to be able to use "today" and "yesterday" to filter results of queries. For example, ,obs TAXA by USER today

This may require additional or implied values, for example to determine if "today" applies to "date observed" or "date added" image

synrg commented 4 years ago

I really need to do #106 before I'd be happy starting this one.

synrg commented 4 years ago

Well, #106 is now done, so ... no excuse not to knock this one off, now!

synrg commented 4 years ago

I have dragged my heels on getting started on this one because it is not defined very well yet. Here are some ideas to firm up what we want here:

  1. Should yesterday typed by itself mean since yesterday or on yesterday? I'm biased towards the latter (i.e. if you say any date selection keyword by itself it means on). Implicitly, this means we're supporting the on concept first and not worrying about since yet. This will help users to select precisely one observation with a sufficiently accurate filter. Let's say I found a frog yesterday at blufftrailns, but I also found a frog there today. To bring up just yesterday's frog at that place:

,obs anura by me yesterday from blufftrailns

  1. Additionally, the day concept isn't well defined yet. Without any idea of what timezone the user is in, the timezone used for the select will be whatever the API uses for this search by default (i.e. I presume either a 24-hour period from 00:00 to 23:59 in whatever timezone the API server is in, or the timezone of the bot; experimentation with a set of observations made close to midnight could determine which). A separate issue is needed for this to be improved.

With those ideas to start with, today could be implemented (internally, --on today), along with yesterday (internally, --on yesterday), and later we can flesh this out with support for absolute & relative dates/times, and since, between, and before.

synrg commented 3 years ago

@michaelpirrello We have for some months now supported on yesterday / since yesterday / until yesterday, and also on today / since today / until today. If you want added instead of observed, use added on yesterday, etc.

It's too confusing to support today or yesterday by themselves, so I'm closing this one, as we at least now have a way to specify date filters, even if it wasn't exactly as you had requested.