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

Reservation Rate excel export #52

Merged
merged 2 commits into from Apr 4, 2022

Conversation

HotStew
Copy link

@HotStew HotStew commented Feb 28, 2022

Changes are well documented in commit messages and code!

Not to be merged quite yet!

To be done:

  • Tests
    • Tests are done, but tests unrelated to these changes are failing.
  • Make up our mind on method of time filtering

See frontend PR: City-of-Helsinki/huvaja#338


Example of generated excel file.

image

@HotStew HotStew force-pushed the reservation-excel-export branch 4 times, most recently from 611fb14 to c65626e Compare March 2, 2022 11:29
reports/api/reservation_rate.py Outdated Show resolved Hide resolved
reports/api/reservation_rate.py Outdated Show resolved Hide resolved
reports/api/reservation_rate.py Outdated Show resolved Hide resolved
reports/api/reservation_rate.py Outdated Show resolved Hide resolved
reports/api/reservation_rate.py Outdated Show resolved Hide resolved
reports/api/reservation_rate.py Outdated Show resolved Hide resolved
reports/tests/test_reservation_rate.py Outdated Show resolved Hide resolved
@HotStew
Copy link
Author

HotStew commented Mar 9, 2022

Most of the tests that were failing were due to a translation mismatch. So nothing critical and doesn't have to be bothered with in this PR. I did however remove another test that was failing due to code changes from a ~year ago that made the test void.

Copy link

@frwickst frwickst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite a lot of things going on here, but I will approve this. I don't know the business logic here or if the data itself is the correct one, I mainly looked at the code in general.

Kevin Seestrand added 2 commits April 4, 2022 13:21
Add new endpoint where you can download an excel
report that contains a separate sheet for each
unit. Each sheet will have a summary that contains
unit name, time filters, reservation rate. Below
summary a list of resources with their sums
of reserved time per each resource. Below this
will be listings of reservation details per resource.

The endpoint will take parameters that will be used
for filtering the queries. Required filters are:
list of units, begin date and end date. Times are
optional, but will default to 08:00 and 16:00.

Create serializers for the purpose of having a simple
top-down data structure.

Use the BaseReport base class for the new view.

Create a custom excel renderer.
Test kept failing due to it testing that an exception
should be raised. But the code that it tests is now
wrapped in a try except block which swallows the raised
exception so it can not be passed to the test.
@HotStew
Copy link
Author

HotStew commented Apr 4, 2022

Added translations to API error messages for fields that the user selects on the frontend.

@frwickst frwickst merged commit 252d8eb into andersinno:hki-huvaja Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants