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
23 stars 8 forks source link

Italien Serie-A support #89

Closed ghost closed 5 years ago

ghost commented 5 years ago

Describe the bug

Exception in thread "main" javax.ws.rs.ProcessingException: Error reading entity from input stream. at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:865) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:784) at org.glassfish.jersey.client.ClientResponse.readEntity(ClientResponse.java:297) at org.glassfish.jersey.client.InboundJaxrsResponse$1.call(InboundJaxrsResponse.java:91) at org.glassfish.jersey.internal.Errors.process(Errors.java:292) at org.glassfish.jersey.internal.Errors.process(Errors.java:274) at org.glassfish.jersey.internal.Errors.process(Errors.java:205) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:365) at org.glassfish.jersey.client.InboundJaxrsResponse.runInScopeIfPossible(InboundJaxrsResponse.java:240) at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:88) at org.blondin.mpg.AbstractClient.call(AbstractClient.java:131) at org.blondin.mpg.AbstractClient.get(AbstractClient.java:69) at org.blondin.mpg.root.MpgClient.getDashboard(MpgClient.java:70) at org.blondin.mpg.Main.process(Main.java:63) at org.blondin.mpg.Main.main(Main.java:59) Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of org.blondin.mpg.root.model.ChampionshipType, problem: Championship type not supported: 5 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 221] (through reference chain: org.blondin.mpg.root.model.Dashboard["leagues"]->java.util.ArrayList[0]->org.blondin.mpg.root.model.League["championship"]) at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67) at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1608) at com.fasterxml.jackson.databind.DeserializationContext.handleInstantiationProblem(DeserializationContext.java:1073) at com.fasterxml.jackson.databind.deser.std.FactoryBasedEnumDeserializer.deserialize(FactoryBasedEnumDeserializer.java:146) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245) at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:138) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) at com.fasterxml.jackson.databind.ObjectReader._unwrapAndDeserialize(ObjectReader.java:1703) at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1571) at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965) at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:838) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.invokeReadFrom(ReaderInterceptorExecutor.java:233) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:212) at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:132) at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:1071) at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:850) ... 14 more Caused by: java.lang.UnsupportedOperationException: Championship type not supported: 5 at org.blondin.mpg.root.model.ChampionshipType.getNameByValue(ChampionshipType.java:23) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at com.fasterxml.jackson.databind.introspect.AnnotatedMethod.callOnWith(AnnotatedMethod.java:122) at com.fasterxml.jackson.databind.deser.std.FactoryBasedEnumDeserializer.deserialize(FactoryBasedEnumDeserializer.java:138) ... 32 more

Join debug files

Depending your championship, join data files set in attachment.

  1. The MPG JSon Response of these Request on https://api.monpetitgazon.com (visible via F12 in your browser):

    • From home : GET /user/dashboard
    • From coach: GET /league/[yourLeagueId]/coach
    • From transfer : GET /league/[yourLeagueId]/transfer/buy
  2. The Players statistics data, one JSon from:

  3. The Players statistics time update datas : https://www.mpgstats.fr/json/leagues.json

  4. The Injury / Suspended data, one full HTML from:

Expected behavior

A clear and concise description of what you expected to happen.

If problem on update team feature, please join the Request and Response (visible via F12 in your browser) of POST /league/[yourLeagueId]/coach when you save your team in MPG.

axel3rd commented 5 years ago

Hello @nicobal, thanks for your report.

The root cause of problem is:

`Caused by: java.lang.UnsupportedOperationException: Championship type not supported: 5` 

=> The Italien Serie A is not (now) supported 😭 (because really new in MPG).


It will be fixed ASAP (I will try to have a look tonight) but : 1) MPG Stats has currently nothing on this league (see https://www.mpgstats.fr/top/Serie-A/custom), because new in MPG => The mercato proposal feature (the 10 best players by line, using previous season) will not work (efficiency for all players to 0), like the recent French Dominos L2 league. So you should do this first mercato manually, without any advice of this bot 😬. 2) I personally have not an Italian MPG league => I will not have the capacity to test the behavior in real condition.

If it doesn't work as expected (when league will be started), I will have need you, with some files as described in bug report template: image

axel3rd commented 5 years ago

@nicobal : Issue (Seria A support) is fixed on last mpg-coach-bot-1.4-SNAPSHOT.zip. Feel free to test it and give feedback (reopen issue(s) if needed). But real value added will be after the first day of Italian season.

ghost commented 5 years ago

It worked! Thank you so much!