Offense/Defense API
-
Hey,
I have a another problem with the sportspress API in combination with offense/defense configuration.
I am developing a frontend Result and Stat Submission Plugin which can be used by teams to enter the stats directly into sportspress via a frontend page. It worked until a certain point.
I tried to find the reason why it stopped working and after some resarch I found out that changing the Performance type in the sportspress Event settings from “Combined” to “Offense -> Defense” caused the malfunction.
In detail:
I tried to enter some stats via the sportspress backend and entered the same stats in my plugin to compare the API output when calling “wp-json/sportspress/v2/events/id”. Surprisingly both outputs were identical. BUT when entering the stats through my plugin the stats wouldn’t show up in the event. Instead I get: “No data available in table”.
I looked up the submitted stats in the database and found out, that the API don’t set the “sp_offense” and “sp_defense” players.
Database after sportspress submission: https://i.imgur.com/VyiHB27.jpg
Database after plugin submission: https://i.imgur.com/6NlqyT5.jpgI know, that there is a difference in the “players” field of the json output when using “Combined” or “Offense -> Defense”. When using “Combined” then “players”:[0,…,0,…] but when using “Offense -> Defense” then “players”:[0,…,0,…,0,…,0,…].
Am I missing some json parameter to make this work or did you forget to implement setting the sp_offense and sp_defense values?
- The topic ‘Offense/Defense API’ is closed to new replies.