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

Enhancement: display "Booking" as a set of attributes and not an object #3

Open
MyrtoG opened this issue Nov 19, 2024 · 1 comment
Open

Comments

@MyrtoG
Copy link
Collaborator

MyrtoG commented Nov 19, 2024

Version

v2

Impact

High

Suggested Priority

High

Description

At the moment, when printing a "Booking" object, we get back a result of an object type. Even though that doesn't necessarily affect the way the application is running at the moment, it could cause problems in the future when debugging.
To identify the issue, follow the steps below.

In the CLI run:

  1. python3
  2. from lib.booking import Booking
  3. booking = Booking(135, "2024-06-05 21:21", 1, 2, 3)
  4. booking
    You will get a result similar to this:
    <lib.booking.Booking object at 0x1047a61e0>

To fix this I suggest adding a repl method in the booking.py:

_def __repr__(self):
    return f"Booking({self.id}, {self.dt}, {self.gid_id}, {self.user_id}, {self.ticket_count})"_

If afer adding the repl method we repeat the steps in the REPL, we should now be getting the result below:

Booking(135, "2024-06-05 21:21", 1, 2, 3)

@neilstudd
Copy link
Contributor

neilstudd commented Nov 19, 2024

Good observation - not sure we can justify it being high priority (the booking objects are only designed to be accessed/displayed via the front-end) but I can't see it causing any harm to make the suggested change, we'll have a think about doing this in a later sprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants