pieforproviders / pieforproviders

We help child care providers and families claim the government funding for which they are already eligible.
GNU General Public License v3.0
26 stars 25 forks source link

[Spike] Passing information from app onto Spreadsheet to print - Attendance Calendar #2785

Open rebeccakarasiktw opened 2 years ago

rebeccakarasiktw commented 2 years ago

πŸ“‹ Summary

The goal of this spike is to make a plan & estimate for implementing the "Paper Calendar" feature.

πŸ‡ΊπŸ‡Έ States this change applies to

πŸ’» Implementation Details

Data we will need to pull into the spreadsheet

Questions we want to answer

Spreadsheets attached Child Care Center Fillable Calendar (edited) (3).xls In-Home (License Exempt) Fillable Calendar (edited) (2).xls License Exempt Home & Licensed Family Child Care Home I & II Fillable Calendar (edited) (3).xls

katelovescode commented 2 years ago

Open questions:

rebeccakarasiktw commented 2 years ago

@katelovescode updated to just limit to spreadsheet

OliverCai0 commented 2 years ago

@rebeccakarasiktw @katelovescode, looking into this, a current issue is that the spreadsheets are in xls format which is largely unsupported by ruby and a lot of other languages, meaning that a lot of the common ways to parse and write to the file results in the formatting being disrupted. I was wondering if it's a necessary requirement to keep the files in xls or if it is possible to just convert them into xlsx files?

OliverCai0 commented 2 years ago

All implementation is currently on the PIE-2785/spreadsheet_info branch. There is currently a job along with a service that outputs a set of xlsx files for each approval of a specified user for a given month and year. The forms are also temporarily in the same directory as the service app/services/attendance_spreadsheet, and the resulting files are, for now, stored in the storage/ directory. Remaining considerations include the appropriate storage mechanism for the generated files (RubyXL seems to have an option to write to a stream rather than saving directly to a disk, documentation can be found here: https://github.com/weshatheleopard/rubyXL).

To test, run

  1. rails c
  2. SpreadsheetAttendancesImporterJob.new.perform_now(user_id: USER_ID, month: MONTH_NUM, year: YEAR)

The resulting files have the current naming convention: attendancesfor{date-range}_{approval_index}.xlsx. There should be two workbooks for every approval, one for the date range of 1-15 and another for 16-31.