File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ function checkForChanges(json) {
69
69
70
70
function printState ( newData , oldData ) {
71
71
if ( oldData != null ) {
72
- console . log ( " Total Votes:" , comma ( newData . tv ) , "+" + comma ( newData . tv - oldData . tv ) ) ;
72
+ var delta = newData . tv - oldData . tv
73
+ console . log ( " Total Votes:" , comma ( newData . tv ) , ( delta > 0 ? "+" : "" ) + comma ( delta ) ) ;
73
74
} else {
74
75
console . log ( " Total Votes:" , comma ( newData . tv ) ) ;
75
76
}
@@ -79,7 +80,8 @@ function printState(newData, oldData) {
79
80
80
81
newData . cand . forEach ( function ( candData ) {
81
82
if ( oldData != null ) {
82
- console . log ( " " + candData . name + ":" , comma ( candData . votes ) , "(+" + comma ( candData . votes - oldData . votes [ candData . name ] ) + ")" ) ;
83
+ var diff = candData . votes - oldData . votes [ candData . name ] ;
84
+ console . log ( " " + candData . name + ":" , comma ( candData . votes ) , ( diff > 0 ? "(+" : "(" ) + comma ( diff ) + ")" ) ;
83
85
if ( newFirst == null ) {
84
86
newFirst = candData . votes ;
85
87
oldFirst = oldData . votes [ candData . name ] ;
You can’t perform that action at this time.
0 commit comments