axel3rd / mpg-coach-bot

MPG (Mon Petit Gazon) coach bot, to automate and optimize weekly actions
https://axel3rd.github.io/mpg-coach-bot/
MIT License
21 stars 8 forks source link

mpgstats API format change on leagues refresh #235

Closed axel3rd closed 1 year ago

axel3rd commented 1 year ago

Today:

Call URL: https://api.mlnstats.com/builds.json (cache duration ms: 3600000)
Read cache file: /tmp/mpg-coach-bot-httpsapimlnstatscombuildsjson
Call URL time elaps ms: 42
Exception in thread "main" java.lang.UnsupportedOperationException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "Ligue-1-2020-2021" (class org.blondin.mpg.stats.model.LeaguesRefresh), not marked as ignorable (5 known properties: "1", "2", "3", "4", "5"])
 at [Source: (File); line: 1, column: 178] (through reference chain: org.blondin.mpg.stats.model.LeaguesRefresh["Ligue-1-2020-2021"])
        at org.blondin.mpg.AbstractClient.call(AbstractClient.java:168)
        at org.blondin.mpg.AbstractClient.get(AbstractClient.java:100)
        at org.blondin.mpg.AbstractClient.get(AbstractClient.java:92)
        at org.blondin.mpg.stats.MpgStatsClient.getLeaguesRefresh(MpgStatsClient.java:49)
        at org.blondin.mpg.stats.MpgStatsClient.getStats(MpgStatsClient.java:38)
        at org.blondin.mpg.Main.getCurrentDay(Main.java:492)
        at org.blondin.mpg.Main.calculateEfficiencies(Main.java:472)
        at org.blondin.mpg.Main.completeAuctionAndcalculateEfficiency(Main.java:443)
        at org.blondin.mpg.Main.processGames(Main.java:186)
        at org.blondin.mpg.Main.processLeague(Main.java:118)
        at org.blondin.mpg.Main.process(Main.java:82)
        at org.blondin.mpg.Main.main(Main.java:71)

https://api.mlnstats.com/builds.json response has changed, looks like now:

{
  "1": "2022-08-04T10:25:19.760Z",
  "2": "2022-08-04T10:25:33.794Z",
  "3": "2022-08-04T11:25:17.318Z",
  "4": "2022-08-04T10:25:51.969Z",
  "5": "2022-08-04T11:25:22.000Z",
  "Ligue-1-2020-2021": "2022-08-04T15:04:23.095Z",
  "Ligue-1-2019-2020": "2022-08-04T15:28:19.922Z",
  "Ligue-1-2021-2022": "2022-08-04T15:29:32.154Z"
}
axel3rd commented 1 year ago

This new content is for past seasons and can be ignored. But 6 & 7 should be added, which will represent Champions League & Super League.