Skip to content

Commit 813139a

Browse files
authored
Release Candidate v0.9.0 (#61)
- Use `team_winner` and `opponent_winner` attributes to determine winner instead of using score NOTE: Not backward compatible with v0.8.x of TeamTracker sensor. Must upgrade to v0.9.0 of TeamTracker sensor to work
1 parent 5bafba1 commit 813139a

File tree

3 files changed

+10
-62
lines changed

3 files changed

+10
-62
lines changed

dist/const.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export let VERSION = "v0.8.1"
1+
export let VERSION = "v0.9.0"

dist/set_defaults.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function initCardData(c) {
1616
c.color = [];
1717
c.timeouts = [];
1818
c.possessionOp = [];
19+
c.winner = [];
1920
}
2021

2122
//
@@ -66,11 +67,13 @@ export function setDefaults(t, lang, stateObj, c, o, sport, team, oppo) {
6667
c.name[team] = stateObj.attributes.team_name;
6768
c.rank[team] = stateObj.attributes.team_rank;
6869
c.record[team] = stateObj.attributes.team_record;
70+
c.winner[team] = stateObj.attributes.team_winner || false;
6971
c.logo[oppo] = stateObj.attributes.opponent_logo;
7072
c.logoBG[oppo] = stateObj.attributes.opponent_logo;
7173
c.name[oppo] = stateObj.attributes.opponent_name;
7274
c.rank[oppo] = stateObj.attributes.opponent_rank;
7375
c.record[oppo] = stateObj.attributes.opponent_record;
76+
c.winner[oppo] = stateObj.attributes.opponent_winner || false;
7477
c.playClock = stateObj.attributes.clock;
7578
if (o.showLeague) {
7679
c.logoBG[team] = stateObj.attributes.league_logo
@@ -80,13 +83,13 @@ export function setDefaults(t, lang, stateObj, c, o, sport, team, oppo) {
8083
c.score[team] = stateObj.attributes.team_score;
8184
c.score[oppo] = stateObj.attributes.opponent_score;
8285

83-
c.scoreOp[1] = 1;
84-
c.scoreOp[2] = 1;
85-
if (Number(c.score[1]) < Number(c.score[2])) {
86-
c.scoreOp[1] = 0.6;
86+
c.scoreOp[1] = .6;
87+
c.scoreOp[2] = .6;
88+
if (c.winner[team]) {
89+
c.scoreOp[team] = 1;
8790
}
88-
if (Number(c.score[2]) < Number(c.score[1])) {
89-
c.scoreOp[2] = 0.6;
91+
if (c.winner[oppo]) {
92+
c.scoreOp[oppo] = 1;
9093
}
9194

9295
if (stateObj.attributes.team_homeaway == 'home') {

dist/set_sports.js

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,9 @@ export function setBasketball(t, stateObj, c, team, oppo) {
7070
// in2 = quarter;
7171
// score = split score into 2 parts
7272
// record = set to second part of split score
73-
// scoreOP = adjust opacity based on total runs
7473

7574
export function setCricket(t, stateObj, c, team, oppo) {
76-
var runs_substring = [];
77-
var runs = [];
78-
var total_runs = [];
7975
var subscores = [];
80-
var i = 0;
8176

8277
c.timeoutsDisplay = 'none';
8378
c.barDisplay = "none";
@@ -100,37 +95,6 @@ export function setCricket(t, stateObj, c, team, oppo) {
10095
if (subscores[2].length > 1) {
10196
c.record[2] = "(" + subscores[2][1];
10297
}
103-
104-
if (stateObj.state == 'POST') {
105-
runs_substring[1] = c.score[1].split("/");
106-
runs_substring[2] = c.score[2].split("/");
107-
108-
runs[1] = runs_substring[1][0].split("&");
109-
runs[2] = runs_substring[2][0].split("&");
110-
111-
total_runs[1] = 0;
112-
total_runs[2] = 0;
113-
114-
i = 0;
115-
while (i < runs[1].length) {
116-
total_runs[1] = total_runs[1] + Number(runs[1][i]);
117-
i = i + 1;
118-
}
119-
i = 0;
120-
while (i < runs[2].length) {
121-
total_runs[2] = total_runs[2] + Number(runs[2][i]);
122-
i = i + 1;
123-
}
124-
125-
if (total_runs[1] > total_runs[2]) {
126-
c.scoreOp[1] = 1.0;
127-
c.scoreOp[2] = 0.6;
128-
}
129-
if (total_runs[1] < total_runs[2]) {
130-
c.scoreOp[1] = 0.6;
131-
c.scoreOp[2] = 1.0;
132-
}
133-
}
13498
}
13599
}
136100
}
@@ -144,7 +108,6 @@ export function setCricket(t, stateObj, c, team, oppo) {
144108
// barLabel = team_total_shots, opponent_total_shots
145109
// finalTerm = clock
146110
// timeoutsDisplay = 'none';
147-
// scoreOp = adjust opacity to show lowest score as winner
148111
//
149112
export function setGolf(t, stateObj, c, team, oppo) {
150113
c.title = c.title || stateObj.attributes.event_name;
@@ -156,14 +119,6 @@ export function setGolf(t, stateObj, c, team, oppo) {
156119
c.finalTerm = stateObj.attributes.clock;
157120
c.timeoutsDisplay = 'none';
158121

159-
if (Number(c.score[1]) < Number(c.score[2])) {
160-
c.scoreOp[1] = 1.0;
161-
c.scoreOp[2] = 0.6;
162-
}
163-
if (Number(c.score[2]) < Number(c.score[1])) {
164-
c.scoreOp[1] = 0.6;
165-
c.scoreOp[2] = 1.0;
166-
}
167122
}
168123

169124
//
@@ -206,7 +161,6 @@ export function setMMA(t, stateObj, c, team, oppo) {
206161
// timeoutsDisplay = 'none';
207162
// barLength = team_total_shots, opponent_total_shots (laps)
208163
// barLabel = (laps)
209-
// scoreOp = adjust opacity to show lowest score as winner
210164
// If NASCAR, remove logos and use initials
211165
//
212166
export function setRacing(t, stateObj, c, team, oppo) {
@@ -223,15 +177,6 @@ export function setRacing(t, stateObj, c, team, oppo) {
223177
c.barLabel[team] = t.translate("racing.teamBarLabel", "%s", String(stateObj.attributes.team_total_shots));
224178
c.barLabel[oppo] = t.translate("racing.teamBarLabel", "%s", String(stateObj.attributes.team_total_shots));
225179

226-
if (Number(c.score[1]) < Number(c.score[2])) {
227-
c.scoreOp[1] = 1.0;
228-
c.scoreOp[2] = 0.6;
229-
}
230-
if (Number(c.score[2]) < Number(c.score[1])) {
231-
c.scoreOp[1] = 0.6;
232-
c.scoreOp[2] = 1.0;
233-
}
234-
235180
if (stateObj.attributes.league.includes("NASCAR")) {
236181
c.logo[team] = null;
237182
c.logo[oppo] = null;

0 commit comments

Comments
 (0)