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"
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
SEASON_ORDERING = ["Spring", "Summer", "Fall", "Winter"]
|
||||
SEASON_ORDERING = ["Winter", "Spring", "Summer", "Fall"]
|
||||
def filter_for_current_season(maps):
|
||||
|
||||
maps = list(maps)
|
||||
|
||||
year = str(datetime.datetime.now().year)
|
||||
|
||||
season = 3
|
||||
season = 0
|
||||
for m in maps:
|
||||
|
||||
if year not in m.mapname:
|
||||
continue
|
||||
else:
|
||||
for i, season_name in enumerate(SEASON_ORDERING):
|
||||
print(i, season_name, m.mapname)
|
||||
if season_name in m.mapname:
|
||||
if season_name in m.mapname and i > season:
|
||||
season = i
|
||||
print(season)
|
||||
|
||||
print(SEASON_ORDERING[season])
|
||||
print(maps)
|
||||
maps_season = list(filter(lambda m: SEASON_ORDERING[season] in m.mapname, maps))
|
||||
print(maps_season)
|
||||
filter_func = lambda m: SEASON_ORDERING[season] in m.mapname and year in m.mapname
|
||||
maps_season = list(filter(filter_func, maps))
|
||||
return maps_season
|
||||
|
||||
class Map(db.Model):
|
||||
|
||||
Reference in New Issue
Block a user