Months Ago Filter Label Confusing and Misleading

Bug #1885759 reported by Rogan Hamby
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Low
Unassigned
3.4
Fix Released
Low
Unassigned

Bug Description

This may have been intentional in the original implementation but the 'months ago' filter in the reporter excludes months that are part of years and only reports remainders. This means that the filter is not useful without a secondary filter for years. This isn't indicated in any intuitive way (or unintuitive IMO) by the label.

For more context,

Example generated query portion:
SELECT EXTRACT(MONTH FROM AGE(NOW(),acirc."xact_start"))

Using a timestamp of '2019-01-10 11:27:04-05' as an example:

SELECT EXTRACT(MONTH FROM AGE(NOW(),'2019-01-10 11:27:04-05'));
date_part
-----------
        5
   (1 row)

This is because EXTRACT only gives the MONTHS provided by AGE not total months:

SELECT AGE(NOW(),'2019-01-10 11:27:04-05');
age
---------------------------------------
1 year 5 mons 20 days 02:07:29.708954
(1 row)

Thus a filter set for 9 months ago or older would not catch this even though it's actually 17 months ago. Also a filter set for 3 months ago would false value (based on intent) a value from years ago so long as the remainder was 3 months.

The function should either be relabled (no recommendation for what) or (my opinion) actually return the number of months ago by extracting year and multiplying it as well. Is anyone using reports with this in such a way that the change would break that?

Revision history for this message
Mike Rylander (mrylander) wrote :

The second option is really the only sane one, and seems straight forward to do. Thus:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/miker/lp-1885759-correct-month-count

tags: added: pullrequest
Changed in evergreen:
assignee: nobody → Rogan Hamby (rogan-hamby)
Revision history for this message
Rogan Hamby (rogan-hamby) wrote :

Tested and works for me, thanks Mike. signoff pushed to : user/rogan/lp1885759_correct_month_count

Changed in evergreen:
assignee: Rogan Hamby (rogan-hamby) → nobody
tags: added: signedoff
Galen Charlton (gmc)
Changed in evergreen:
milestone: none → 3.5.1
status: New → Confirmed
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed to master, rel_3_5, and rel_3_4. Thanks, Rogan and Mike!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.