diff --git a/db.py b/db.py index fef2eb28..0d3ffa88 100644 --- a/db.py +++ b/db.py @@ -898,9 +898,6 @@ class Halloween(Base): puzzle_piece_e = Column(DateTime) puzzle_piece_f = Column(DateTime) puzzle_piece_g = Column(DateTime) - puzzle_piece_h = Column(DateTime) - puzzle_piece_i = Column(DateTime) - puzzle_piece_j = Column(DateTime) boss_battle = Column(DateTime) @@ -921,12 +918,6 @@ class Halloween(Base): return self.puzzle_piece_f elif item == 7: return self.puzzle_piece_g - elif item == 8: - return self.puzzle_piece_h - elif item == 9: - return self.puzzle_piece_i - elif item == 10: - return self.puzzle_piece_j else: raise ValueError("No such puzzle piece") @@ -947,18 +938,12 @@ class Halloween(Base): self.puzzle_piece_f = value elif key == 7: self.puzzle_piece_g = value - elif key == 8: - self.puzzle_piece_h = value - elif key == 9: - self.puzzle_piece_i = value - elif key == 10: - self.puzzle_piece_j = value else: raise ValueError("No such puzzle piece") def pieces_completed(self) -> int: count = 0 - for i in range(1, 11): + for i in range(1, 8): if self[i]: count += 1 return count @@ -969,9 +954,9 @@ class Halloween(Base): halloweens = session.query(Halloween).all() session.close() started = bool(halloweens) - completed = [False for _ in range(10)] + completed = [False for _ in range(7)] for h in halloweens: - for i in range(10): + for i in range(7): if h[i+1]: completed[i] = True return started, completed diff --git a/discordbot.py b/discordbot.py index 4262db2a..172a760c 100644 --- a/discordbot.py +++ b/discordbot.py @@ -526,7 +526,7 @@ class RoyalDiscordBot(discord.Client): if "ghostbusters" in now_playing.plain_text().lower(): halloween = await loop.run_in_executor(executor, session.query(db.Halloween) .filter_by(royal=enqueuer).one_or_none) - halloween[4] = True + halloween[5] = datetime.datetime.now() # END await loop.run_in_executor(executor, session.commit) await loop.run_in_executor(executor, session.close) diff --git a/ohciaovedochestaileggendoilmiostato.py b/ohciaovedochestaileggendoilmiostato.py index 69a845cb..8722a723 100644 --- a/ohciaovedochestaileggendoilmiostato.py +++ b/ohciaovedochestaileggendoilmiostato.py @@ -47,12 +47,15 @@ def page_voiceofevil(): if request.form.get("solution", "") != "1": abort(400) return + if "user_id" not in request.form: + abort(403) + return db_session = db.Session() - halloween = db_session.query(db.Halloween).filter_by(royal_id=fl_session["user_id"]).one_or_none() + halloween = db_session.query(db.Halloween).filter_by(royal_id=request.form["user_id"]).one_or_none() if halloween is None: abort(403) return - halloween[3] = True + halloween[4] = datetime.datetime.now() db_session.commit() return redirect(url_for("page_owlcaptain")) @@ -63,11 +66,11 @@ def page_mansion(): abort(400) return db_session = db.Session() - halloween = db_session.query(db.Halloween).filter_by(royal_id=fl_session["user_id"]).one_or_none() + halloween = db_session.query(db.Halloween).filter_by(royal_id=request.form["user_id"]).one_or_none() if halloween is None: abort(403) return - halloween[5] = True + halloween[6] = datetime.datetime.now() db_session.commit() return redirect(url_for("page_owlcaptain")) diff --git a/templates/minis/halloween.html b/templates/minis/halloween.html index 407cae96..66e4dcd4 100644 --- a/templates/minis/halloween.html +++ b/templates/minis/halloween.html @@ -7,7 +7,7 @@ Lune ottenute