Showing 1 changed files with 4 additions and 3 deletions
+4 -3
analyse-votes-AN
... ...
@@ -121,12 +121,13 @@ function update_database () {
121 121
                 done
122 122
             done
123 123
 
124
-            if test $((($scrutin*100)/$last)) -ne $progress; then
125
-                progress=$((($scrutin*100)/$last))
124
+            if test $(( ($scrutin - $first) * 100 / ( $last - $first ) )) -ne $progress; then
125
+                progress=$(( ($scrutin - $first) * 100 / ( $last - $first ) ))
126 126
                 if test $(($progress % ${update_progress:-1})) -eq 0; then
127 127
                     now=$(date +%s)
128 128
                     delta=$(( $now - $begin ))
129
-                    echo $progress%, ETA: $(date +%H:%M:%S -d "$(($delta * ($last - $scrutin) / $scrutin)) seconds")
129
+#                   scrutin = first+1 à la première itération
130
+                    echo $progress%, ETA: $(date +%H:%M:%S -d "$(($delta * ($last - $scrutin) / ($scrutin - $first) )) seconds")
130 131
                 fi
131 132
             fi
132 133
         done