Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Excel for Maintenance report #41

Open
huguesf opened this issue Sep 12, 2019 · 7 comments
Open

Generate Excel for Maintenance report #41

huguesf opened this issue Sep 12, 2019 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@huguesf
Copy link
Collaborator

huguesf commented Sep 12, 2019

Related to #28

... so that they can input those numbers into what??

Final TTSN: Total Time Since New
TNI : Time to Next Inspection
TTNI : Total Time of the Next Inspection
Issues per glider per day (instead of only per glider). Confirm with ETS how it is filled.

Why are there negative TNI numbers?
What is the purpose of having the number of flights on the top of the report? Could we export total flight / day / glider instead of a grand total? Does the total of Tow plane flights excluded?

Debert-Stats-Report-17-Jul-18-17-Jul-18.pdf

@huguesf huguesf added this to the Provide reports milestone Sep 12, 2019
@LukeTowers
Copy link
Contributor

Negative TNI is caused by the TTNI being set incorrectly, either through user error / not understanding what that value is for or through the TTNI not being updated after an inspection has been completed.

For the specific aircraft in that report you can see that their TTNI is set to 99, 100, or 50, which could be users thinking that they were supposed to enter the TNI in the TTNI field as 100 & 50 are the inspection intervals for a lot of aircraft.

We could probably help prevent that error from happening in the future by improving the language used on those fields to make it more explicit what they are for and how to use them (although there's still the problem of TTNI not being updated after an inspection all of the time).

@huguesf huguesf self-assigned this Sep 21, 2019
@huguesf
Copy link
Collaborator Author

huguesf commented Sep 21, 2019

The report really contains multiple reports. In CSV that could not be what we want.

I'm looking at ways to generate an Excel compatible file from the app and attach it next to the pdf in the email. Otherwise, I'll be looking at generating multiple csv files and attach them to the email.

Also, I'm looking into splitting the generation of the report from the sending of email. My goal would be for the report generator to be able to generate both pdf and csv.

Another option would be to just generate csv/excel. Any needs for the pdf? If not, we could just remove that.

Reports in the PDF:

  • Maintenance report

  • Columns: Véhicule, Issues, Date, Air Time, Ground Launches, Final TTSN, TNI, TTNI

  • CTC National Report Stats

  • Columns: ?, Gilders Flights, Gliders Hours, Tow Aircraft Flights, Tow Aircraft Hours

  • CTC Squadron Attendante

  • Columns: Date, Squadron, Number of cadets attended, Number of Cadet Glider Fans, Number of Glider Flights, Number of Cadet Fam Flights in Tow A/C, Comment

  • CTC Personnel Stats

  • Columns: ?, Days Worked, PIC Flights, PIC flights/day worked, Dual Flights, Dual Flights/day worked

  • CTC Staff Cadet Attendance

  • Columns: Name, San, Site, Days Worked

  • CTC Staff Upgrades

  • Columns: Upgrade, Name, Type of Participant, Site

  • Glider Usage

  • Columns: Gliders callsign, Glider name, Glider Flights [Transit, Famil, Prof, Student, Upgrade], Glider Hours [Transit, Famil, Prof, Student, Upgrade], Time Flown, Current TTSN

  • Towplane Usage

  • Columns: Towplane callsign, Towplane name, Scout Hours [Transit, Towing, TPC, Maintenance, Prof, Upgrade, Fam], Scout Flights Fam, Time Flown, Current TTSN

  • Winch Usage

  • Columns: ?, Currnt TTSN, Hours, Flights

@huguesf
Copy link
Collaborator Author

huguesf commented Sep 21, 2019

About TTNI and TNI having wrong value. Any idea to clarify the expected values? Maybe we should create a new issue for that.

@huguesf
Copy link
Collaborator Author

huguesf commented Sep 22, 2019

Found a package on github to create Excel file on iOS/macOS called ExportExcel.
I updated it to Swift 5. Seems to need to wait for Xcode package manager to see it (or for the original author to merge into the master branch).
With that package, it will be possible to create an Excel spreadsheet with each report into its own worksheet.

@huguesf
Copy link
Collaborator Author

huguesf commented Sep 22, 2019

A bit awkward... I had to star my own report for ExcelExport to show up in Swift Packages.

@LukeTowers
Copy link
Contributor

About TTNI and TNI having wrong value. Any idea to clarify the expected values? Maybe we should create a new issue for that.

@huguesf done: #43. I don't have any specific ideas because I don't have the application open in front of me, but I'll see if I can get a hold of the old iPad we used to use for the CFS so I can play around with the app on that and come up with some ideas.

@huguesf
Copy link
Collaborator Author

huguesf commented Oct 4, 2019

@kirvanp, in the DEBERT example report, the section gliding centre NATIONAL REPORT STATS has a total line which does not balance with the numbers shown above the total line:

image

In the next example - that I made up from automated tests, there are 7 flights, but the total only shows 6. To get there, I created a flight for the 7 towplane sequences. It also shows only 2 "visible" cells under Tow Aircraft Flights, and 6 "visible" cells under "Hours".

image

I try removing the towplane sequence named "Tow" (not the "tow course" sequence), then another cell that become visible next to TOW, but it shows 0 (zero) - normal since there is no more flight for that sequence. This is the result:

image

Notice that I corrected the unbalanced html tags, but does not seem to be related to what I describe above.

The maintenance report section when 7 flights (one per possible sequence) is created:

image

So, I wonder what is "normal" behavior, and what's not? Is that section is even used? People from DEBERT do not seem to find any issue with that. What is you opinion?

huguesf added a commit that referenced this issue Oct 6, 2019
Balance few html tags in statsReportFromDate, with test to ensure html is well formed (based on cases that were found).
Refactor of tests and add new data and tests on the resulting html.
Added an extension to XCTest to test a value extracted from a regular expression group.
huguesf added a commit that referenced this issue Oct 7, 2019
Extracted generateMaintenanceReport from statsReportFromDate.
Added necessary code to test ground launches in testStatsReportFromDateIncludeAircraftInReport.
huguesf added a commit that referenced this issue Oct 8, 2019
huguesf added a commit that referenced this issue Oct 11, 2019
…mDate with the goal to extract the code to generate the report from the code to gather the data. Generation through tests of both version of StatsReportFromDate. (todo: I can't see the schema for the automated tests from other computer when I pull the branche. Where are those schema??)
huguesf added a commit that referenced this issue Oct 11, 2019
…dron number for the different cadet. This makes it easy to differentiate between them in the report.
huguesf added a commit that referenced this issue Oct 12, 2019
…tGeneratorTests.testStatsReportFromDateIncludeAircraftInReport to view a complete report.
huguesf added a commit that referenced this issue Oct 30, 2019
…ame order. (both version of the report)

Misc. modification to the testing code.
-- may still have a small issue with package manager... need to add the Package.resolved file to GitHub.
huguesf added a commit that referenced this issue Nov 1, 2019
…string (ie #FFFFFF or #FFF or #FFFFFFFF)

Added a first draft of the ExcelStatsReportFromDate generator (with corresponding protocol).
huguesf added a commit that referenced this issue Nov 1, 2019
…variadic parameters cannot be passed down to other functions, and was needed to implement param with default value at protocol level).

Changed parameters with default value to overload with protocol extension, needed to use protocol when changing implementation of generator..
first draft for ExcelStatsReportFromDateGenerator. Now need to modify both generator to do the complete job from generating the report and the file to attach (HTML -> PDF or Excel).
few options:
1- keep the HTML to PDF conversion outside the report generator (the conversion need UI which seems to be incompatible with UnitTesting)
2- use call back instead of returning a string (allow for any intermediate process)
3- remove the HTML and HTML to PDF processes since that might not be necessary anymore once we can generate and attach an Excel file.
(or a combo of few above options)
huguesf added a commit that referenced this issue Nov 8, 2019
…sReportFromDate(for). Still missing cell merged down.
huguesf added a commit that referenced this issue Nov 8, 2019
@huguesf huguesf changed the title Generate CSV for Maintenance Generate Excel for Maintenance report Nov 11, 2019
huguesf added a commit that referenced this issue Nov 15, 2019
…sses.

Removed from Formater classes all report parameters. They are now reusable classes for any reports.
Moved the StatsReportFromDate (version with Formater) in its own class.
huguesf added a commit that referenced this issue Nov 15, 2019
…now include generic formatters for Html and Excel file. Also changed "formater" to "formatter".
huguesf added a commit that referenced this issue Nov 15, 2019
… to synchronize packages between developers.
huguesf added a commit that referenced this issue Nov 16, 2019
…g to completely move to the newer version that takes a formatter.
huguesf added a commit that referenced this issue Nov 16, 2019
huguesf added a commit that referenced this issue Nov 18, 2019
…include a way to test it from the simulator (via ActivityViewController). This is incomplete. Still need to fix the send by email with multiple attachment.

Also added a way to generate content and get result using an handler function (instead of a delegate class) - see Formatters.swift.
huguesf added a commit that referenced this issue Nov 19, 2019
…nd distribution. WARNING!! This version does not work with iPad simulator for an unkown reason related to how Activity work.
huguesf added a commit that referenced this issue Nov 19, 2019
… of yyyy-MM-dd HH:mm:ss : file.function#lineNumber : message

Implemented the new way to create StatsReportFromDate for both site and region.
Ensure the CompletionHandler is always called even if an error occurs (no output) during htmlFormatter.generateResult.
Ensure to keep the generated PDF url instead of the HTML source.
Keep instance of the pdf generator, the activity and the MFMailComposeViewController until the report processing complete; fix the bug with the activity or email popup not showing or the app freeze.
Fix the subject for the Region Stats Report.
huguesf added a commit that referenced this issue Nov 20, 2019
…lmost the same code; moved it to the report param structure.
huguesf added a commit that referenced this issue Nov 20, 2019
@huguesf huguesf added the enhancement New feature or request label Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants