Bug 361625 - Tellico ("Video Collection") - Date field filter bugs
Summary: Tellico ("Video Collection") - Date field filter bugs
Status: RESOLVED FIXED
Alias: None
Product: tellico
Classification: Applications
Component: general (show other bugs)
Version: 2.3.9
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Robby Stephenson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-11 10:17 UTC by ejr67
Modified: 2016-04-16 20:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.12
Sentry Crash Report:


Attachments
Example database and screen-shots (80.26 KB, application/gzip)
2016-04-11 10:17 UTC, ejr67
Details
Bug #2 not fixed in version 2.3.11 (84.80 KB, image/png)
2016-04-11 15:26 UTC, ejr67
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ejr67 2016-04-11 10:17:04 UTC
Created attachment 98337 [details]
Example database and screen-shots

Version: 2.3.9 4.14.15, Kubuntu packages
OS: Linux (x86_64) release 4.2.0-35-generic
Compiler: x86_64-linux-gnu-gcc

Hi,

I am reporting here two bugs in relation to filtering on "Date" fields in a Video Collection. I believe they are unrelated, but who knows, maybe they are.

Please see example database attached (but they are easily reproducible - you should be able to get the same behaviour if you create your own database).

I have added an additional "custom" date field, which I've called "My Date" (through Collection > Collection Fields). This could be used for instance for "Last time movie was watched" or "Date when DVD purchased" or whatever...
I am making the distinction below between this "custom date" field, and "standard date" fields, such as "Date Created" and "Date Modified".
I have created two entries (one would suffice, actually - there is no need for two entries to see the bugs) both with "My Date" = 2016-01-02 (2nd Jan 2016) and "Date Created" = 2016-04-11 (11th Apr 2016)
I have also created 5 filters:
- "After" - Filter on "My Date" "is after" 01/01/2016
- "Before" - Filter on "My Date" "is before" "01/01/2017"
- "Created-After" - Filter on "Date Created" "is after" 01/01/2016
- "Created-Before" - Filter on "Date Created" "is before" "01/01/2017"
- "Equals" - Filter of "My Date" "equals" "02/01/2016" (2nd Jan 2016)
Please note that, based on the data above, all 5 filters should find 2 matching records.

BUG #1:
-----------
You can check that the filters have been created as described above (with the criterion being "is after" or "is before" as described) in the xml file provided. You may also want to create your own filters to double-check.
Regardless of the filter, whenever I double-click on it (or Right-Click > Modify Filter), the window that opens shows the criterion as "equals" and not "is before" or "is after" as the filter was created. Please see attached screen-shot for filter "After".
This is true for all four "before" or "after" filters.

BUG #2:
-----------
The three filters "Created-After", "Created-Before" and "Equals" work correctly - all three correctly find two matching records.
The two filters "After" and "Before" (which filter based on the "custom date") do not work correctly. They fail to find the two records that should match the criterion ("My Date" being before or after the set date - in both cases, the criterion should be met). Please see attached screen-shot.
I am therefore led to believe this bug affects only "custom" (not "standard")  date fields, and only when the criterion is "is before" or "is after".
Comment 1 Robby Stephenson 2016-04-11 10:59:32 UTC
I believe this bug was fixed in Tellico version 2.3.10.
Comment 2 ejr67 2016-04-11 15:26:52 UTC
Created attachment 98339 [details]
Bug #2 not fixed in version 2.3.11
Comment 3 ejr67 2016-04-11 15:30:20 UTC
Hi Robbie,

Thank you very much for the prompt turn-around.

I have now downloaded the code for version 2.3.11 and compiled it on my laptop (only version 2.3.9 seems to be available from the Kubuntu repository for some reason).

I confirm that Bug #1 above ("is after" and "is before" criteria replaced by "equals" when modifying a filter) is fixed in this version.

However. Bug #2 ("is before" or "is after" filter on "custom", non-standard, date fields not working) does not seem to be fixed. Please see new attached screen-shot Bug_Dates-3.png
Both "Before" and "After" filters should return 2 entries, whereas they seem to find none.
Comment 4 Robby Stephenson 2016-04-16 20:51:00 UTC
Git commit ce6372fae186040ce8a3553e93364c1f73af809f by Robby Stephenson.
Committed on 16/04/2016 at 20:49.
Pushed by rstephenson into branch 'master'.

Properly account for zero-padding in filter dates

Custom dates would have dates in format yyy-M-d, not ISO format,
i.e not zero-padded. Correct for the problem, and also fix the issue
when saving
FIXED-IN: 2.3.12

M  +6    -2    src/filter.cpp
M  +8    -0    src/gui/datewidget.cpp
M  +6    -3    src/tests/filtertest.cpp
M  +1    -1    src/translators/tellicoxmlexporter.cpp
M  +8    -0    src/translators/xmlstatehandler.cpp

http://commits.kde.org/tellico/ce6372fae186040ce8a3553e93364c1f73af809f
Comment 5 Robby Stephenson 2016-04-16 20:56:36 UTC
Git commit bedb2eba02adaa645db983c39dba3d92d8cecd6c by Robby Stephenson.
Committed on 16/04/2016 at 20:56.
Pushed by rstephenson into branch '2.3'.

Properly account for zero-padding in filter dates

Custom dates would have dates in format yyy-M-d, not ISO format,
i.e not zero-padded. Correct for the problem, and also fix the issue
when saving
FIXED-IN: 2.3.12

Conflicts:
	src/translators/tellicoxmlexporter.cpp

M  +6    -2    src/filter.cpp
M  +8    -0    src/gui/datewidget.cpp
M  +6    -3    src/tests/filtertest.cpp
M  +8    -0    src/translators/xmlstatehandler.cpp

http://commits.kde.org/tellico/bedb2eba02adaa645db983c39dba3d92d8cecd6c