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

Group 4 - refactoring library class #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Group 4 - refactoring library class #16

wants to merge 1 commit into from

Conversation

PtrBld
Copy link
Member

@PtrBld PtrBld commented Nov 13, 2023

No description provided.

print("*********************************************")

for b in self.get_books():
if Genre.CRIME in b.genres:
Copy link
Collaborator

Choose a reason for hiding this comment

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

combine the two if statements to one if statement

max = b
# end if
# end if
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Else branch not necessary


# Prints crime audio books
def print_longest_crime_audio_book(self) -> str:
crime_audio_books: list[Book] = []
Copy link
Collaborator

Choose a reason for hiding this comment

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

Variable is never used

for b in self.get_books():
if Genre.CRIME in b.genres:
if b._book_type == "Audio":
if max is not None and max.duration < b.duration:
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a bug here, it should be "max is None or max.duration < b.duration"

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, there may be multiple books of the same maximum length. Then, only the first one is actually printed out.

print(f"Title: {max.title}")
print(f"Author: {max.authors}")
print(f"Duration: {max.duration}")
print(f"______________________________")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add the other variables of book to the printout

print(f"Duration: {max.duration}")
print(f"______________________________")
return str(max)

Copy link
Collaborator

@SchubertS96 SchubertS96 Nov 22, 2023

Choose a reason for hiding this comment

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

The constructor and the class variable should be above the print function in our opinion for better readability

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

Successfully merging this pull request may close these issues.

3 participants