Opened 13 years ago

Closed 13 years ago

#17829 closed Bug (wontfix)

Admin date filter's "Past 7 days" actually returns past 8 days.

Reported by: Glenn Washburn <development@…> Owned by: nobody
Component: contrib.admin Version: 1.4-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Essentially the problem is analogous to

 end = 10
 start = end - 7
 qs.filter(f__gte=start, f__lte=end) # this will allow 8 numbers not 7 (namely: [3,4,5,6,7,8,9,10])

I think this is fairly obvious (and easy to fix), but I an explain more if needed.

Change History (6)

comment:1 by Aymeric Augustin, 13 years ago

Resolution: worksforme
Status: newclosed

list_filter on a DateTimeField is mostly useful if applied to a field that stores a creation or modification date.

It's Monday, 8am. Do you expect to see the updates of last Monday? Probably yes. The filter actually does "Past seven days (complete) + current day (partial)", which was shortened to "Past 7 days" for readability.

In the example above, the current code shows 7,33 days worth of data (assuming you have no data in the future). Your "easy fix" would show 6,33 days instead. I'm not convinced this would be significantly more correct.

We'd need a good reason, good enough to warrant breaking backwards compatibility, to change this.

Last edited 13 years ago by Aymeric Augustin (previous) (diff)

comment:2 by Glenn Washburn <development@…>, 13 years ago

Yes, I thought about this after submitting the ticket. Though, I think this is still an issue for DateTimeFields. Basically, I think what is expected, is that no future dates are selected (if it can be helped). I don't really care about this being fixed, but I think it is still a bug.

comment:3 by Aymeric Augustin, 13 years ago

Resolution: worksforme
Status: closedreopened
Triage Stage: UnreviewedDesign decision needed

comment:4 by Aymeric Augustin, 13 years ago

To be honest, I don't care much either. Let's keep it as DDN to get more opinions...

comment:5 by Henrique C. Alves, 13 years ago

For a end-user, "past 7 days" essentialy means "show me everything since, and including, last <week day>". You don't do the math using hours, you compute with whole days. I believe the current behaviour is the most expected behaviour, or at least the less surprising one.

comment:6 by Aymeric Augustin, 13 years ago

Resolution: wontfix
Status: reopenedclosed

Yeah, I've just re-implemented this feature in the context of another ticket and I felt like hcarvalhoalves.

Note: See TracTickets for help on using tickets.
Back to Top