File tree Expand file tree Collapse file tree 2 files changed +32
-29
lines changed Expand file tree Collapse file tree 2 files changed +32
-29
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const isNumeric = function (n) {
17
17
return ! isNaN ( parseFloat ( n ) ) && isFinite ( n ) ;
18
18
} ;
19
19
20
- const convertDurationToTimestamp = function ( duration ) {
20
+ export const convertDurationToTimestamp = function ( duration ) {
21
21
let parts = duration . substring ( 0 , duration . length - 1 ) . split ( '.' ) ;
22
22
if ( parts . length === 1 ) {
23
23
return parseInt ( parts [ 0 ] ) * 1000000000 ;
@@ -58,4 +58,4 @@ const TimestampFormatter = {
58
58
} ) ;
59
59
}
60
60
} ;
61
- export default TimestampFormatter ;
61
+ export default TimestampFormatter ;
Original file line number Diff line number Diff line change 6
6
</template >
7
7
8
8
<script >
9
- import {TEAM_BLUE , TEAM_YELLOW } from " ../../refereeState" ;
9
+ import {TEAM_BLUE , TEAM_YELLOW } from " @/refereeState" ;
10
+ import {convertDurationToTimestamp } from " @/TimestampFormatter" ;
10
11
11
- export default {
12
- name: " TeamYellowCardNextDue" ,
13
- props: {
14
- teamColor: String ,
15
- },
16
- data () {
17
- return {
18
- TEAM_YELLOW : TEAM_YELLOW ,
19
- TEAM_BLUE : TEAM_BLUE
20
- }
12
+ export default {
13
+ name: " TeamYellowCardNextDue" ,
14
+ props: {
15
+ teamColor: String ,
16
+ },
17
+ data () {
18
+ return {
19
+ TEAM_YELLOW : TEAM_YELLOW ,
20
+ TEAM_BLUE : TEAM_BLUE
21
+ }
22
+ },
23
+ computed: {
24
+ team () {
25
+ return this .$store .state .matchState .teamState [this .teamColor ]
21
26
},
22
- computed: {
23
- team () {
24
- return this .$store .state .matchState .teamState [this .teamColor ]
25
- },
26
- latestCardTime () {
27
- if (this .activeYellowCards .length > 0 ) {
28
- let cards = [];
29
- for (let card of this .activeYellowCards ) {
30
- cards .push (card .timeRemaining )
31
- }
32
- cards .sort ()
33
- return cards[0 ];
27
+ latestCardTime () {
28
+ if (this .activeYellowCards .length > 0 ) {
29
+ let cards = [];
30
+ for (let card of this .activeYellowCards ) {
31
+ cards .push (convertDurationToTimestamp (card .timeRemaining ))
34
32
}
35
- return 0 ;
36
- },
37
- activeYellowCards () {
38
- return this . team . yellowCards . filter ( e => e . timeRemaining !== ' 0s ' ) ;
33
+ cards . sort ( function ( a , b ) {
34
+ return a - b;
35
+ });
36
+ return cards[ 0 ] ;
39
37
}
38
+ return 0 ;
39
+ },
40
+ activeYellowCards () {
41
+ return this .team .yellowCards .filter (e => e .timeRemaining !== ' 0s' );
40
42
}
41
43
}
44
+ }
42
45
</script >
43
46
44
47
<style scoped>
You can’t perform that action at this time.
0 commit comments