Bug 461749 - Allow interruption of report generation
Summary: Allow interruption of report generation
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: reports (show other bugs)
Version: git (master)
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-13 00:50 UTC by Jack
Modified: 2022-11-15 14:52 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jack 2022-11-13 00:50:05 UTC
If you display the Reports View, and select a report that can take a long time to generate (Investment Worth Graph is the one I have had this issue with the most) there is no way to interrupt it, so you have to wait for it to generate the complete (all stocks and all time) the report before you can configure it for a more limited time frame or set of investments.
I realize you can right click on the report name and select Configure, but this seems to fully generate the report anyway, before displaying the Configuration dialog - so it doesn't save any time, and doesn't help if you double click before remembering or noticing how long the report takes.
Comment 1 jesse 2022-11-13 03:36:26 UTC
Another idea: Maybe the right solution should allow the user to configure the report before running it. Maybe from the list of reports, add a configure button next to the report name, to allow the user to configure the report before running it. This will allow the user to set the date range and other selections for optimizations before the code attempts to generate the report.
Comment 2 Jack 2022-11-13 03:45:21 UTC
The problem right now is that you CAN right click on the  report name and select Configure, but it runs the full report before displaying the configure dialog.  Going straight to the dialog first would be a good solution.
Comment 3 jesse 2022-11-13 03:47:34 UTC
Ok. I see. I think it should wait to generate the report until the configure dialog is closed or Apply is pressed by the user.
Comment 4 Thomas Baumgart 2022-11-13 15:46:28 UTC
Git commit c1419875cf6de29e416c50fe5773b502fef99642 by Thomas Baumgart.
Committed on 13/11/2022 at 15:34.
Pushed by tbaumgart into branch 'master'.

Don't render report if opened through configuration

A report could take some time to be calculated and rendered. If one
wants to modify a report it is first opened and completely rendered
before one can change the configuration.

This change shows the configuration dialog but does not render the
report before it is closed.
FIXED-IN: master

M  +22   -8    kmymoney/plugins/views/reports/kreportsview.cpp
M  +18   -1    kmymoney/plugins/views/reports/kreportsview.h
M  +6    -6    kmymoney/plugins/views/reports/kreportsview_p.h

https://invent.kde.org/office/kmymoney/commit/c1419875cf6de29e416c50fe5773b502fef99642
Comment 5 Jack 2022-11-13 22:42:44 UTC
This does work, but if I open the config dialog for a report I decide not to modify, there is no way to close the report quickly, since closing the config dialog starts the complete report generation.  I know I could modify the report in some way that would make generation quick, but then I'd have to remember to delete that new copy of the report.

Even if it can't be done easily now, I'd prefer to either keep this open at a low priority or file a new bug to truly be able to interrupt report generation.
Comment 6 jesse 2022-11-14 00:14:28 UTC
Why not put a cancel button and if the cancel button is pressed, do not generate the report and close the dialog?
Comment 7 Jack 2022-11-14 00:38:31 UTC
Displaying a "Cancel" button is trivial.  Having a button on the Configure dialog that totally closes the report without generating results is probably not difficult.  However, creating a button on the report (not just on the Configure dialog) and connecting it something that cleanly interrupts the report generation process is harder.  How difficult it is depends on whether the report generating code is written in a way it can cleanly be interrupted, and have it clean up all data structures that might be used again if that (or some other) report is run again later in the same session.  That's why I leave it up to Thomas how to proceed.
Comment 8 jesse 2022-11-15 14:52:48 UTC
Yes, I think the clean up of data structures and such should be left to the developers to figure out and engineer the best solution. From a user perspective though, I think it makes senses that the user should be allowed to configure the report without the need for the report to execute first. This would keep the issue you are reporting from happening. I have not personally ran into it as my data size is very low. But one day I will face this. 

I believe, from a user perspective, it would be ideal if I can open a configuration for a report, and decide after configuring it if I want to : 
1. Cancel - disregard the changes and stop the report execution. Return the user to the list of reports to choose from.
2. Apply - Apply the changes to the report but do not execute the report. Return the user to the list of reports to choose from. 
3. Run - Apply the changes to the report and execute the report generation. 

This would result with three options for the user in the report configuration dialog box.