Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
chore: improve print console
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinNitroG committed Jan 15, 2025
1 parent 51034db commit f719d14
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/check_phat_nguoi/context/plates/models/plate_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,21 @@ def __eq__(self, other: Any):
# TODO: Handle show details later when main updates that option
@override
def __str__(self) -> str:
plate_detail: str = f"Biển số: {self.plate}" + (
plate_info: str = f"Biển số: {self.plate}" + (
f"\nChủ sở hữu: {self.owner}" if self.owner else ""
)
if self.violations:
return (
plate_detail
+ "\n"
plate_detail: str = (
(
f"{plate_info}\n\n"
+ "\n".join(
f"Lỗi vi phạm #{order}:\n{violation}\n"
for order, violation in enumerate(self.violations, start=1)
)
)
else:
return plate_detail
if self.violations
else plate_info
)
return plate_detail.strip()


__all__ = ["PlateDetail"]
4 changes: 3 additions & 1 deletion src/check_phat_nguoi/print_console/print_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ def print_console(self) -> None:
logger.info("No plate details. Skip printing")
return
# HACK: Have to convert each plate detail to str to use join method :v
print("\n---\n".join(str(plate_detail) for plate_detail in self.plate_details))
print(
"\n\n---\n\n".join(str(plate_detail) for plate_detail in self.plate_details)
)

0 comments on commit f719d14

Please sign in to comment.