Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apps/wtatennis/wta_tennis.star
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ Also updated the variable for player color to match the ATP app

v1.14
If the next scheduled match is the final, then look ahead 48hrs instead of the normal 12hrs to make the final appear sooner

v1.14.1
Bug fix - allowed for situations where "Womens Doubles" is first listed event for tournament (as in WTA Finals), similar to Mens Singles
"""

load("encoding/json.star", "json")
Expand Down Expand Up @@ -134,6 +137,8 @@ def main(config):
# and if so, Womens Singles will be next (GroupingsID = 1)
if WTA_JSON["events"][x]["groupings"][0]["grouping"]["slug"] == "mens-singles":
GroupingsID = 1
if WTA_JSON["events"][x]["groupings"][0]["grouping"]["slug"] == "womens-doubles":
GroupingsID = 1
TotalMatches = len(WTA_JSON["events"][x]["groupings"][GroupingsID]["competitions"])

for y in range(0, TotalMatches, 1):
Expand Down Expand Up @@ -215,6 +220,8 @@ def main(config):
if diffTournStart.hours < 0 and diffTournEnd.hours > 0:
if WTA_JSON["events"][x]["groupings"][0]["grouping"]["slug"] == "mens-singles":
GroupingsID = 1
if WTA_JSON["events"][x]["groupings"][0]["grouping"]["slug"] == "womens-doubles":
GroupingsID = 1
for y in range(0, len(WTA_JSON["events"][x]["groupings"][GroupingsID]["competitions"]), 1):
MatchState = WTA_JSON["events"][x]["groupings"][GroupingsID]["competitions"][y]["status"]["type"]["description"]

Expand Down Expand Up @@ -263,6 +270,8 @@ def main(config):
if diffTournStart.hours < 0 and diffTournEnd.hours > 0:
if WTA_JSON["events"][x]["groupings"][0]["grouping"]["slug"] == "mens-singles":
GroupingsID = 1
if WTA_JSON["events"][x]["groupings"][0]["grouping"]["slug"] == "womens-doubles":
GroupingsID = 1
for y in range(0, len(WTA_PREFIX), 1):
# if the match is scheduled ("pre") and the start time of the match is scheduled for next 12 hrs, add it to the list of scheduled matches
if WTA_PREFIX[y]["status"]["type"]["state"] == "pre":
Expand Down Expand Up @@ -371,6 +380,8 @@ def getLiveScores(SelectedTourneyID, EventIndex, InProgressMatchList, JSON):

if JSON["events"][EventIndex]["groupings"][0]["grouping"]["slug"] == "mens-singles":
GroupingsID = 1
if JSON["events"][EventIndex]["groupings"][0]["grouping"]["slug"] == "womens-doubles":
GroupingsID = 1

# pop the index from the list and go straight to that match
x = InProgressMatchList.pop()
Expand Down Expand Up @@ -625,6 +636,8 @@ def getCompletedMatches(SelectedTourneyID, EventIndex, CompletedMatchList, JSON)

if JSON["events"][EventIndex]["groupings"][0]["grouping"]["slug"] == "mens-singles":
GroupingsID = 1
if JSON["events"][EventIndex]["groupings"][0]["grouping"]["slug"] == "womens-doubles":
GroupingsID = 1

Player1_Name = JSON["events"][EventIndex]["groupings"][GroupingsID]["competitions"][x]["competitors"][0]["athlete"]["shortName"]
Player2_Name = JSON["events"][EventIndex]["groupings"][GroupingsID]["competitions"][x]["competitors"][1]["athlete"]["shortName"]
Expand Down Expand Up @@ -960,6 +973,8 @@ def getScheduledMatches(SelectedTourneyID, EventIndex, ScheduledMatchList, JSON,

if JSON["events"][EventIndex]["groupings"][0]["grouping"]["slug"] == "mens-singles":
GroupingsID = 1
if JSON["events"][EventIndex]["groupings"][0]["grouping"]["slug"] == "womens-doubles":
GroupingsID = 1

# check that we have players before displaying them or display blank line
if "athlete" in JSON["events"][EventIndex]["groupings"][GroupingsID]["competitions"][x]["competitors"][0]:
Expand Down