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

Download CSV of report #129

Open
hackartisan opened this issue May 6, 2019 · 12 comments
Open

Download CSV of report #129

hackartisan opened this issue May 6, 2019 · 12 comments
Labels
feature New feature or request Travel user story

Comments

@hackartisan
Copy link
Member

As an AA I need a downloadable CSV of a report so I can edit / reference it when transferring data to an external system

@carolyncole
Copy link
Member

not mvp

@kevinreiss
Copy link
Member

One of our admin assistants asked for this again.

@sandbergja sandbergja added feature New feature or request newdev labels Sep 2, 2022
@leefaisonr
Copy link
Contributor

Would it help to be able to also download calendar as csv to be able to export/share?

#673

@leefaisonr leefaisonr self-assigned this Sep 29, 2022
@leefaisonr
Copy link
Contributor

Questions to ask:
What is a report? It is not a model, how would I define a "report"?
What are the fields that would need to be in the CSV and how should one interact with the user interface to download the CSV?

(byebug) User.count
4
(byebug) User.last
#<User id: 3228, provider: "cas", uid: "uid4", created_at: "2022-09-29 17:52:58.329928000 +0000", updated_at: "2022-09-29 17:52:58.329928000 +0000">
(byebug) User.first
#<User id: 3225, provider: "cas", uid: "uid1", created_at: "2022-09-29 17:52:58.070638000 +0000", updated_at: "2022-09-29 17:52:58.070638000 +0000">
(byebug) Request.last
#<TravelRequest id: 11224, creator_id: 3221, start_date: "2020-05-21", end_date: "2020-05-23", request_type: "TravelRequest", purpose: "My grand purpose", created_at: "2022-09-29 17:52:58.721944000 +0000", updated_at: "2022-09-29 17:52:58.741501000 +0000", travel_category: "professional_development", absence_type: nil, status: "approved", event_title: "Wow 2020, Location", start_time: nil, end_time: nil, hours_requested: nil, participation: "other">
(byebug) Request.where(creator_id: 3221)
#<ActiveRecord::Relation [#<AbsenceRequest id: 11218, creator_id: 3221, start_date: "2019-10-12", end_date: "2019-10-13", request_type: "AbsenceRequest", purpose: nil, created_at: "2022-09-29 17:52:58.424789000 +0000", updated_at: "2022-09-29 17:52:58.424789000 +0000", travel_category: nil, absence_type: "vacation", status: "pending", event_title: nil, start_time: nil, end_time: nil, hours_requested: 0.103e2, participation: nil>, #<AbsenceRequest id: 11220, creator_id: 3221, start_date: "2019-10-14", end_date: "2019-10-15", request_type: "AbsenceRequest", purpose: nil, created_at: "2022-09-29 17:52:58.497706000 +0000", updated_at: "2022-09-29 17:52:58.497706000 +0000", travel_category: nil, absence_type: "sick", status: "pending", event_title: nil, start_time: nil, end_time: nil, hours_requested: 0.1e2, participation: nil>, #<AbsenceRequest id: 11221, creator_id: 3221, start_date: "2019-10-15", end_date: "2019-10-16", request_type: "AbsenceRequest", purpose: nil, created_at: "2022-09-29 17:52:58.510394000 +0000", updated_at: "2022-09-29 17:52:58.525877000 +0000", travel_category: nil, absence_type: "sick", status: "approved", event_title: nil, start_time: nil, end_time: nil, hours_requested: 0.173e2, participation: nil>, #<TravelRequest id: 11222, creator_id: 3221, start_date: "2019-10-21", end_date: "2019-10-23", request_type: "TravelRequest", purpose: "My grand purpose", created_at: "2022-09-29 17:52:58.627831000 +0000", updated_at: "2022-09-29 17:52:58.636852000 +0000", travel_category: nil, absence_type: nil, status: "pending", event_title: "Awesome Event 2019, Location", start_time: nil, end_time: nil, hours_requested: nil, participation: "other">, #<TravelRequest id: 11223, creator_id: 3221, start_date: "2020-10-20", end_date: "2012-10-23", request_type: "TravelRequest", purpose: "My grand purpose", created_at: "2022-09-29 17:52:58.669652000 +0000", updated_at: "2022-09-29 17:52:58.697427000 +0000", travel_category: nil, absence_type: nil, status: "approved", event_title: "Best Event Ever 2020, Location", start_time: nil, end_time: nil, hours_requested: nil, participation: "other">, #<TravelRequest id: 11224, creator_id: 3221, start_date: "2020-05-21", end_date: "2020-05-23", request_type: "TravelRequest", purpose: "My grand purpose", created_at: "2022-09-29 17:52:58.721944000 +0000", updated_at: "2022-09-29 17:52:58.741501000 +0000", travel_category: "professional_development", absence_type: nil, status: "approved", event_title: "Wow 2020, Location", start_time: nil, end_time: nil, hours_requested: nil, participation: "other">]>
(byebug) Request.where(creator_id: 3221).count
6

@leefaisonr
Copy link
Contributor

How advanced would we need the downloaded CSV to be? Should we be able to filter the results, then download the file? Or is it just one file that will be downloadable with all requests? @kevinreiss

@leefaisonr
Copy link
Contributor

leefaisonr commented Sep 30, 2022

Here is a quick way to generate a downloadable CSV file (via VSCode): spec > features > download_csv_script.rb

Here are some examples of the generated data:

creator,status,start_date,end_date,notes,request_type
"Mraz, Shanda (uid18692)",denied,2022-11-04,2022-11-05,#<Note::ActiveRecord_Associations_CollectionProxy:0x00007fe750268740>,AbsenceRequest
"Williamson, Felicita (uid395)",denied,2023-05-29,2023-06-01,#<Note::ActiveRecord_Associations_CollectionProxy:0x00007fe74d6b8460>,TravelRequest
"Williamson, Felicita (uid395)",denied,2023-10-23,2023-10-26,#<Note::ActiveRecord_Associations_CollectionProxy:0x00007fe74d6b1fe8>,TravelRequest

@kevinreiss
Copy link
Member

The use case I understand here is a departmental administrator who wants to download all approved requests for a given time period. If leveraging the filters we have in the report screen seems more that we want to get into I think the options to get given sets of time (last three months, last six months, year, all requests).

@kevinreiss
Copy link
Member

kevinreiss commented Oct 3, 2022

Fields desired are Staff member First/Last Name, trip ID number, Event Name, Event start date/end date.

@leefaisonr leefaisonr assigned maxkadel and unassigned leefaisonr Oct 13, 2022
@maxkadel maxkadel removed their assignment Oct 14, 2022
@maxkadel
Copy link
Contributor

maxkadel commented Oct 14, 2022

This ticket will focus on the UI portion of this feature - this will generate the same report as the one generated in #829, and should accept a start and end date.

@maxkadel
Copy link
Contributor

@sandbergja sandbergja moved this to In Progress in DACS Rails Oct 19, 2022
@sandbergja sandbergja moved this from In Progress to Ready in DACS Rails Oct 19, 2022
@sandbergja sandbergja moved this from Ready to Backlog in DACS Rails Oct 19, 2022
@sandbergja sandbergja moved this from Backlog to Ready in DACS Rails Oct 19, 2022
@sandbergja sandbergja moved this from Ready to In Progress in DACS Rails Oct 26, 2022
@sandbergja sandbergja self-assigned this Oct 26, 2022
@sandbergja
Copy link
Member

@kevinreiss I have a permissions question on this one. It don’t think all staff users should be able to download a complete list of approved requests. I thought of two possible behaviors:

  • Only certain users are able to download the report (e.g. only department heads, or only people who report to Anne?).
  • Everyone are able to download the CSV, but it only has the entries they have permission to see (e.g. Kevin could download a CSV that contained his requests and ours, but not anybody else’s)?

@sandbergja sandbergja removed their assignment Oct 26, 2022
@sandbergja sandbergja moved this from In Progress to Blocked in DACS Rails Oct 26, 2022
@sandbergja sandbergja removed the newdev label Dec 7, 2022
@kevinreiss
Copy link
Member

The latter scenario is in line with how the current /reports feature works. You only see the staff you report to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request Travel user story
Projects
Status: Blocked
Development

No branches or pull requests

6 participants