ericberman / MyFlightbookWeb

The website and service for MyFlightbook
48 stars 18 forks source link

Enhance user control over the summarized properties in Totals #518

Closed KayRJay closed 4 years ago

KayRJay commented 4 years ago

The Totals function does not give the user much control over which flight properties or characteristics are summarized (other than a "flat list" vs. "grouped"). The Totals function provides only the following types of totals:

Under "Other totals" there are only these totals: Go-arounds, Ground Instruction Received, Landings - Stop and Go and Power-off Landings. The "Other totals" may be based on the history of my flights, so perhaps there are others.

As a student, I'd like to know how many maneuvers of a given type I've done, to be sure I'm well-practiced. So, I'd like to be able to know how flights included stalls or simulated engine outs, or the number of flights I've solo'd and the total time in solo flights. A pilot might want to see total flight times other than those in a "standard logbook" (say, co-pilot time), or might want to know the number of flights with various aerobatic maneuvers.

In general, it should be possible to get totals for any "summable" property/characteristic, and the number of flights with any specific property/characteristic (even if that property/characteristic IS summable).

One (probably the best) idea is to use Templates to control what is presented in the Totals function, as was suggested for the logbook itself ((issue #479). The default display could remain as is, but there could be a drop-down to select a Template to specify which properties and characteristics are summarized.

Another idea is to have a drop-down like the one where new flights are added, allowing the user to choose properties and characteristics to summarize. A user selection like this should probably be sticky, retained across sessions.

Lastly, while it is nice to be able to get totals for a subset of flights (after a search), it is unfortunate that the Totals function doesn't total the criteria used for a search. After a search for flights with any or all of a group of properties (e.g., stalls and steep turns), the Totals function should include summaries (total time or count) for those properties/characteristics used in the search.

ericberman commented 4 years ago

Any summable property should already be included in totals. Note that I never include a total that is zero - I strip all of those - so you'll never see a total for anything you haven't logged.

I'd have to check the code, but I think the only exception to that is if you explicitly blacklist a property (Profile->Preferences->Flight properties).

I don't show number of flights in totals for a variety of reasons, but you can click on any of these items and see the # of flights that have it. You can also search for a given property and read off the # of flights.

I'm not quite following your last two paragraphs here.

KayRJay commented 4 years ago

Any summable property should already be included in totals.

Good.

I don't show number of flights in totals for a variety of reasons,

If one of those reasons is not wanting to clutter the output ... well, there is plenty of blank space, with either format of totals (list or grouped). Alternatively, you could provide the number of flights corresponding to a total in a pop-up if the cursor hovers over the total label.

From an implementation point of view, I realize that SELECT COUNT(*), SUM(X), SUM(Y) only provides one count ... the number of flights that satisfy the WHERE clause, regardless of whether the flight has an X or Y value greater than zero. And GROUP BY doesn't help. However, this does:

select
      (*), /* total flights in the result set */
      max (case when X > 0 then X else 0 end) as TOTAL_X_TIME,
      max (case when X > 0 then 1 else 0 end) as FLIGHTS_WITH_SOME_X_TIME ...

Clever, huh?

you can click on any of these items and see the # of flights that have it.

Yes, but that does a search, and takes me away from the totals. It also changes the search criteria. Unhelpful if I want to see the numbers of flights contributing to several totals. And wasteful of CPU cycles (and mouse clicks) if I have to execute many queries to get what I want.

You can also search for a given property and read off the # of flights.

Likewise.

I'm not quite following your last two paragraphs here.

Another idea is to have a drop-down ...

Screen Shot 2020-03-03 at 2 16 28 PM

Lastly, while it is nice to be able to get totals for a subset of flights (after a search), it is unfortunate that the Totals function doesn't total the criteria used for a search. After a search for flights with any or all of a group of properties (e.g., stalls and steep turns), the Totals function should include summaries (total time or count) for those properties/characteristics used in the search ... Slide2

ericberman commented 4 years ago

Ahhh, now I understand; thanks. I addressed this in my comment for #522 - the issue is that "slow flight", for example, is not something you count, it's something you did. I.e., you say "We did slow flight in our lesson today", but you don't say "we did 3 slow flights in our lesson today". So I could count the # of flights that have that property. I think that's what you were asking for.

Since there are LOTS of true/false properties, I'd probably only want to show them in totals sometimes. Perhaps, as you suggest, only if you search for flights that contain the property? Gotta think about that a bit...

ericberman commented 4 years ago

Funny, sometimes the simple feature requests get really complicated and the seemingly complicated feature requests are trivial. This is in the latter.

The query was explicitly excluding boolean properties because a "sum" makes no sense for them. But the boolean value is already stored as a 1 or a 0 in the integer field for the property so the summation was already doing the correct semantics. So I include them in the totals query for properties.

BUT...to control clutter, I exclude them if they meet any of three criteria: