1 - when onperiod is run, take the now() time, and subtract say 5 days in seconds from it (meaning it works as long as onperiod was run within 5 days of the new moon)
2 - use this value as lower bound search
3 - iterate until the next new moon, use as start,
4 - iterate more until second new moon, use as end
Why
Currently cycle stats start time is set to whenever onperiod is run end_time is set to 29.5 days after
This is because in the past, we did not have actual moon cycle times on contract. We were estimating.
Fix
On onPeriod, search for the closest new moon to the now() time, for the start Then set end to the next New Moon after that
Using the moonphases tables in the cycle.seeds contract.
https://telos.bloks.io/account/cycle.seeds?loadContract=true&tab=Tables&account=cycle.seeds&scope=cycle.seeds&limit=100&table=moonphases
How (suggestion)
1 - when onperiod is run, take the now() time, and subtract say 5 days in seconds from it (meaning it works as long as onperiod was run within 5 days of the new moon) 2 - use this value as lower bound search 3 - iterate until the next new moon, use as start, 4 - iterate more until second new moon, use as end
Cleos example to illustrate bounds search