Add Date term to KActivities Stats to filter on resource event date
ClosedPublic

Authored by meven on Jul 24 2019, 1:54 PM.

Details

Summary

Add a Term Date to Query to filter on ResourceEvent start column when querying for resources.
Add two special cases : today and yesterday

Test Plan

Manual through the test app
autotest

Diff Detail

Repository
R159 KActivities Statistics
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
meven created this revision.Jul 24 2019, 1:54 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJul 24 2019, 1:54 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
meven requested review of this revision.Jul 24 2019, 1:54 PM
meven updated this revision to Diff 62473.Jul 24 2019, 2:11 PM

Improve sql padding

ivan requested changes to this revision.Jul 24 2019, 8:02 PM

Joining with ResourceEvent is a problem. At least make it not get joined if the date filter is not present.

autotests/QueryTest.h
54

tes -> test

src/resultset.cpp
182

setDate above is by value, here it is const-ref. Check for the size of the type and decide on one of these.

313

This is a potential efficiency problem - ResourceEvent is the quickest growing table. I don't like the idea for it to always be joined.

422

Also, add an empty line above - I know I like empty lines too much, but ... :)

This revision now requires changes to proceed.Jul 24 2019, 8:02 PM
meven updated this revision to Diff 62520.Jul 25 2019, 7:38 AM

Optionaly join with ResourceEvent when date filtering is being used, review feedback

meven marked an inline comment as done.Jul 25 2019, 7:40 AM
meven added inline comments.
src/resultset.cpp
182

QDate size is 8 byte, so on most systems nowadays it will equal to a ref size, so I am opting towards the simpler and more stable one : by value.

meven marked 2 inline comments as done.Jul 25 2019, 7:41 AM
meven updated this revision to Diff 62522.Jul 25 2019, 8:15 AM

Add an automated test on date filtering

meven edited the test plan for this revision. (Show Details)Jul 25 2019, 8:42 AM
meven marked an inline comment as done.
ivan added inline comments.Jul 25 2019, 5:20 PM
src/resultset.cpp
293–299

Any reason for the rename?

meven marked 3 inline comments as done.Jul 25 2019, 5:45 PM
meven added inline comments.
src/resultset.cpp
293–299

It is so that the ResourceEvent join in resourceEventJoinClause works with every sql request.
Other wise I would have needed a parameter or multiple functions to make the left join work.

meven marked 2 inline comments as done.Jul 25 2019, 5:46 PM
ivan accepted this revision.Jul 27 2019, 5:10 AM
This revision is now accepted and ready to land.Jul 27 2019, 5:10 AM
meven edited the summary of this revision. (Show Details)Jul 27 2019, 6:48 AM
This revision was automatically updated to reflect the committed changes.