dproofreaders icon indicating copy to clipboard operation
dproofreaders copied to clipboard

First day of "Projects Created Each Day" graph is always negative

Open cpeel opened this issue 2 years ago • 2 comments

@srjfoo noticed that the first day of the Projects Created Each Day graph is negative, and by the looks of the code it will always be. That's because the code works by using the project_state_stats table which records the total number of projects in a state in a day. The graph_data.inc script pulls that info for every day in the month, and then uses array_successive_difference() to subtract one day from the other -- but we never actually have the value of the day before the current month, so there's no way for the first value to not be <0.

cpeel avatar May 28 '23 00:05 cpeel

Interesting - I wonder why the same doesn't happen for Projects Proofed Each Day According to the comment in cumulative_month_proj

    // snapshot is taken just after midnight,
    // so day = 1 has total at beginning of month

so, the bar for the first day of the month should be the difference between the value for day 2 and the value for day 1. It appears correct at the other end of the graph in the sense that there is an entry for 26th (on 27th July)

Not easy to look at on TEST since there's very little data

windymilla avatar Jul 27 '23 20:07 windymilla

Not easy to look at on TEST since there's very little data

Yeah -- we could make a point of creating a project or two a day for the next several days, rolling over into August. That's likely to be the best test.

Edit: actually, what's probably needed is some warning before the test suite is needed so that we can set up a run of several days straddling the beginning of the month.

srjfoo avatar Jul 27 '23 21:07 srjfoo