diff --git a/CommonCore/SQL/src/de/steamwar/sql/Season.java b/CommonCore/SQL/src/de/steamwar/sql/Season.java deleted file mode 100644 index 588717a5..00000000 --- a/CommonCore/SQL/src/de/steamwar/sql/Season.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.sql; - -import java.util.Calendar; - -public class Season { - private Season() {} - - public static int getSeason() { - Calendar calendar = Calendar.getInstance(); - int yearIndex = calendar.get(Calendar.MONTH) / 4; - return (calendar.get(Calendar.YEAR) * 3 + yearIndex); - } - - public static String getSeasonStart() { - Calendar calendar = Calendar.getInstance(); - int month = calendar.get(Calendar.MONTH); - if (month <= 3) { - return calendar.get(Calendar.YEAR) + "-1-1"; - } else if (month <= 7) { - return calendar.get(Calendar.YEAR) + "-5-1"; - } else { - return calendar.get(Calendar.YEAR) + "-9-1"; - } - } - - public static String convertSeasonToString(int season){ - if (season == -1) return ""; - int yearSeason = season % 3; - int year = (season - yearSeason) / 3; - return String.format("%d-%d", year, yearSeason + 1); - } - - public static int convertSeasonToNumber(String season){ - if (season.isEmpty()) return -1; - String[] split = season.split("-"); - try { - return Integer.parseInt(split[0]) * 3 + Integer.parseInt(split[1]) - 1; - } catch (NumberFormatException e) { - return -1; - } - } -} diff --git a/WebsiteBackend/src/de/steamwar/sql/Stats.kt b/WebsiteBackend/src/de/steamwar/sql/Stats.kt index 9cb546dc..ea0a0fef 100644 --- a/WebsiteBackend/src/de/steamwar/sql/Stats.kt +++ b/WebsiteBackend/src/de/steamwar/sql/Stats.kt @@ -61,17 +61,8 @@ private val fightCount = "SELECT COUNT(*) AS num FROM FightPlayer WHERE UserID = fun getFightCount(user: SteamwarUser) = useDb { exec(fightCount, args = listOf(IntegerColumnType() to user.getId())) { getNum(it) } } -private const val rankedList = - "SELECT UserName, Elo FROM UserData, UserElo WHERE UserID = id AND GameMode = ? AND Season = ? ORDER BY Elo DESC" - fun getRankedList(gamemode: String): List> = useDb { - exec(rankedList, args = listOf(VarCharColumnType() to gamemode, IntegerColumnType() to Season.getSeason())) { - val list = mutableListOf>() - while (it.next()) { - list.add(it.getString("UserName") to it.getInt("Elo")) - } - list - } ?: emptyList() + emptyList() } private const val fightList =