1414 </div >
1515 <div class =" details" >{{ $t('matomo.visits').toLowerCase() }} {{ $t('matomo.period.'+currentPeriod) }}.</div >
1616 </div >
17- <div :class =" ['difference', visitsDiff.status, {grey: loading}]" >
17+ <div v-if = " isFinite(visitsDiff.diff) " :class =" ['difference', visitsDiff.status, {grey: loading}]" >
1818 <span v-if =" loading" ><span class =" loader" ></span ></span >
1919 <span v-else >{{visitsDiff.string}}%</span >
2020 <div v-if =" !loading" class =" icon" ><svg ><use href =" #icon-matomo-arrow-up" /></svg ></div >
2828 <span v-else >{{durationString}}</span ></div >
2929 <div class =" details" >{{ $t('matomo.duration.caption') }}.</div >
3030 </div >
31- <div :class =" ['difference', durationDiff.status, {grey: loading}]" >
31+ <div v-if = " isFinite(durationDiff.diff) " :class =" ['difference', durationDiff.status, {grey: loading}]" >
3232 <span v-if =" loading" ><span class =" loader" ></span ></span >
3333 <span v-else >{{durationDiff.string}}%</span >
3434 <div v-if =" !loading" class =" icon" ><svg ><use href =" #icon-matomo-arrow-up" /></svg ></div >
3939 <h5 >{{ $t('matomo.bounce') }}</h5 >
4040 <div class =" big-number" >
4141 <span v-if =" loading" ><span class =" loader" ></span ></span >
42- <span v-else >{{current.bounce}}% </span >
42+ <span v-else >{{bounceString}} </span >
4343 </div >
4444 <div class =" details" >{{ $t('matomo.bounce.caption') }}.</div >
4545 </div >
46- <div :class =" ['difference', bounceDiff.status, {grey: loading}]" >
46+ <div v-if = " isFinite(bounceDiff.diff) " :class =" ['difference', bounceDiff.status, {grey: loading}]" >
4747 <span v-if =" loading" ><span class =" loader" ></span ></span >
4848 <span v-else >{{bounceDiff.string}}%</span >
4949 <div v-if =" !loading" class =" icon" ><svg ><use href =" #icon-matomo-arrow-up" /></svg ></div >
5454 <h5 >{{ $t('matomo.actions') }}</h5 >
5555 <div class =" big-number" >
5656 <span v-if =" loading" ><span class =" loader" ></span ></span >
57- <span v-else >{{current.actions }}</span >
57+ <span v-else >{{actionsString }}</span >
5858 </div >
5959 <div class =" details" >{{ $t('matomo.actions.caption') }}.</div >
6060 </div >
61- <div :class =" ['difference', actionsDiff.status, {grey: loading}]" >
61+ <div v-if = " isFinite(actionsDiff.diff) " :class =" ['difference', actionsDiff.status, {grey: loading}]" >
6262 <span v-if =" loading" ><span class =" loader" ></span ></span >
6363 <span v-else >{{actionsDiff.string}}%</span >
6464 <div v-if =" !loading" class =" icon" ><svg ><use href =" #icon-matomo-arrow-up" /></svg ></div >
@@ -107,7 +107,8 @@ export default {
107107 let string = prefix + Math .abs (diff)
108108 return {
109109 string: string,
110- status: status
110+ status: status,
111+ diff: diff
111112 }
112113 },
113114 durationDiff () {
@@ -117,7 +118,8 @@ export default {
117118 let string = prefix + Math .abs (diff)
118119 return {
119120 string: string,
120- status: status
121+ status: status,
122+ diff: diff
121123 }
122124 },
123125 bounceDiff () {
@@ -127,7 +129,8 @@ export default {
127129 let string = prefix + Math .abs (diff)
128130 return {
129131 string: string,
130- status: status
132+ status: status,
133+ diff: diff
131134 }
132135 },
133136 actionsDiff () {
@@ -137,12 +140,19 @@ export default {
137140 let string = prefix + Math .abs (diff)
138141 return {
139142 string: string,
140- status: status
143+ status: status,
144+ diff: diff
141145 }
142146 },
143147 durationString () {
144148 return this .formatTime (this .current .duration )
145149 },
150+ bounceString () {
151+ return ! isFinite (this .current .bounce ) ? ' –' : this .current .bounce + ' %'
152+ },
153+ actionsString () {
154+ return ! isFinite (this .current .actions ) ? ' –' : this .current .actions + ' %'
155+ },
146156 isPositive () {
147157 return ! this .loading
148158 },
@@ -254,7 +264,7 @@ export default {
254264 },
255265 formatTime (time ) {
256266 let t = Math .floor (time)
257- return (t - (t%= 60 )) / 60 + (9 < t ? ' mn ' : ' mn 0' ) + t + ' s'
267+ return isFinite (t) ? (t - (t%= 60 )) / 60 + (9 < t ? ' mn ' : ' mn 0' ) + t + ' s' : ' – '
258268 },
259269 firstN (obj , n ) {
260270 return Object .keys (obj).slice (0 , n).reduce (function (el , index ) {
@@ -327,7 +337,7 @@ export default {
327337 },
328338 diff (current , prev ) {
329339 let diff = (current - prev) / prev * 100
330- return diff .toFixed (2 )
340+ return diff .toFixed (2 )
331341 }
332342 },
333343}
0 commit comments