mirror of
https://github.com/FAUSheppy/tmnf-replay-server.git
synced 2025-12-05 22:51:37 +01:00
fix: correct ordering & remove debug prints
Some checks failed
Container Build for tmnf-replay-server / docker (push) Failing after 12s
Some checks failed
Container Build for tmnf-replay-server / docker (push) Failing after 12s
This commit is contained in:
14
server.py
14
server.py
@@ -22,29 +22,25 @@ app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
|||||||
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("SQLITE_LOCATION") or "sqlite:///sqlite.db"
|
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("SQLITE_LOCATION") or "sqlite:///sqlite.db"
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
|
||||||
SEASON_ORDERING = ["Spring", "Summer", "Fall", "Winter"]
|
SEASON_ORDERING = ["Winter", "Spring", "Summer", "Fall"]
|
||||||
def filter_for_current_season(maps):
|
def filter_for_current_season(maps):
|
||||||
|
|
||||||
maps = list(maps)
|
maps = list(maps)
|
||||||
|
|
||||||
year = str(datetime.datetime.now().year)
|
year = str(datetime.datetime.now().year)
|
||||||
|
|
||||||
season = 3
|
season = 0
|
||||||
for m in maps:
|
for m in maps:
|
||||||
|
|
||||||
if year not in m.mapname:
|
if year not in m.mapname:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
for i, season_name in enumerate(SEASON_ORDERING):
|
for i, season_name in enumerate(SEASON_ORDERING):
|
||||||
print(i, season_name, m.mapname)
|
if season_name in m.mapname and i > season:
|
||||||
if season_name in m.mapname:
|
|
||||||
season = i
|
season = i
|
||||||
print(season)
|
|
||||||
|
|
||||||
print(SEASON_ORDERING[season])
|
filter_func = lambda m: SEASON_ORDERING[season] in m.mapname and year in m.mapname
|
||||||
print(maps)
|
maps_season = list(filter(filter_func, maps))
|
||||||
maps_season = list(filter(lambda m: SEASON_ORDERING[season] in m.mapname, maps))
|
|
||||||
print(maps_season)
|
|
||||||
return maps_season
|
return maps_season
|
||||||
|
|
||||||
class Map(db.Model):
|
class Map(db.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user