Skip to content

Commit

Permalink
solution1
Browse files Browse the repository at this point in the history
  • Loading branch information
artemIg1990 committed Jan 15, 2025
1 parent 39311c7 commit 4866b8c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ class CinemaHall(models.Model):
rows = models.IntegerField(null=False)
seats_in_row = models.IntegerField(null=False)

def __str__(self):
def __str__(self) -> str:
return self.name

@property
def capacity(self) -> int:
return self.rows * self.seats_in_row


class MovieSession(models.Model):
show_time = models.DateTimeField()
cinema_hall = models.ForeignKey(CinemaHall,
Expand Down
2 changes: 1 addition & 1 deletion services/movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def get_movies(genres_ids: list = None, /,
return movies


def get_movie_by_id(movie_id) -> Movie:
def get_movie_by_id(movie_id: int) -> Movie:
return Movie.objects.filter(id=movie_id)


Expand Down
2 changes: 1 addition & 1 deletion services/movie_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_movies_sessions(session_date: datetime.date = None) -> QuerySet:


def get_movie_session_by_id(movie_session_id: int) -> MovieSession:
return MovieSession.objects.get(id=movie_sessin_id)
return MovieSession.objects.get(id=movie_session_id)


def update_movie_session(session_id: int,
Expand Down

0 comments on commit 4866b8c

Please sign in to comment.