From dc9cb20695f7b8f6faf5b2de898ed8c0b7a1b809 Mon Sep 17 00:00:00 2001 From: Nathan <Nathan.baker303@gmail.com> Date: Thu, 21 Nov 2024 19:16:27 +0000 Subject: [PATCH] why am i still working on this...? --- main.py | 3 ++- src/cinemaObj.py | 11 +++++++++-- src/staffUser.py | 24 +++++++++++++----------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index 02e8383..e83ee9d 100644 --- a/main.py +++ b/main.py @@ -163,5 +163,6 @@ def main_cli() -> None: # following code will only execute if run directly from this file. if __name__ == "__main__": + logging.debug("STARTING main_cli") main_cli() - logging.debug("main_cli finished, program exiting. bye bye!") + logging.debug("main_cli finished, program exiting. bye bye!") \ No newline at end of file diff --git a/src/cinemaObj.py b/src/cinemaObj.py index ac86e52..8d140b6 100644 --- a/src/cinemaObj.py +++ b/src/cinemaObj.py @@ -28,12 +28,19 @@ class Cinema(object): def update_screen(self, screen:Screen, sizeHeight:float, sizeWidth:float, resolutionHeight:int, resolutionWidth:int, capacity:int) -> None: raise NotImplementedError() - def get_listings(self): + def get_showings(self) -> tuple: + """_summary_ + gets list of movie showings in self, odered by time starting from 30mins past the current time. + + Returns: + tuple: movie showings in time order. + """ + raise NotImplementedError() # return listing if dict/jason format? return self.listings def addListing(self, movieID): - # get movie details via movieId + # get movie details via movieId from db # append list with movie ID and more details to be showen in listing, eg; name, description, picture path. raise NotImplementedError() diff --git a/src/staffUser.py b/src/staffUser.py index 1a80f73..cc4ba00 100644 --- a/src/staffUser.py +++ b/src/staffUser.py @@ -3,7 +3,7 @@ from .constants import DBNAME from .dbfunc import * from .cinemaObj import Cinema - +# trying to make this a base implementation for all user classes. class StaffUser(object): def __init__(self): @@ -11,7 +11,7 @@ class StaffUser(object): self.userName:str = "" self.userPass:str = "" self.permissionLevel:int = 0 - self.cinemas = [0] + self.cinemas = [] def __str__(self): return f"{self.__class__.__name__} user object(userID={self.userID}, userName={self.userName}, userPass={self.userPass}, permissionLevel={self.permissionLevel})" @@ -25,11 +25,9 @@ class StaffUser(object): # this will loop with i as any key from dictData and self.dict that matches, i hope lol. for i in dictData.keys(), self.__dict__.keys(): self.i = dictData[i] - - def logout(self): - logging.debug(f"user {self.userID} logging out.") - self._save_self_to_db() - self.close() + # replace cinema_ids in self.cinemas with Cinema objects + for i in self.cinemas: + self.cinemas[i] = Cinema(id=i) def _save_self_to_db(self) -> None: """save self.__dict__ to db.""" @@ -47,18 +45,22 @@ class StaffUser(object): self.close() def return_film_listings(self) -> list: + """gets film listings from cinema object""" logging.debug("called returnFilmListings func") listings = [] - for i in self.cinemas: - cinema = Cinema(id=i) - listings.append(cinema.get_listings()) + for cinema in self.cinemas: + listings.append(cinema.get_showings()) return listings def createBooking(self) -> None: logging.debug("called createBooking func") raise NotImplementedError() + + def veiwBookings(self) -> list: + logging.debug("called veiwBookings func") + raise NotImplementedError() - def manageBooking(self) -> None: + def updateBooking(self) -> None: logging.debug("called manageBooking func") raise NotImplementedError() -- GitLab