]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Don't print max, min or average times if package has only been emerged once
authorEsko Kokkonen <esko@localhost.(none)>
Mon, 6 Jun 2011 10:20:01 +0000 (13:20 +0300)
committerEsko Kokkonen <esko@localhost.(none)>
Mon, 6 Jun 2011 10:20:01 +0000 (13:20 +0300)
emerge-timer.py

index 95b84b20fb86ae51b1ec3440be463bd6179464f2..a422cd2098ca35546bfddf5f2736060a2e53c5ef 100755 (executable)
@@ -65,25 +65,31 @@ def print_times(times):
     times.sort()
     times.reverse()
 
-    print package, "emerged", emerge_number, "times"
-    print "Max time", int(round(times[0][0]/60)), "min", int(times[0][0]%60),
-    print "s", "at", str(times[0][1])
-    print "Min time", int(round(times[len(times)-1][0]/60)), "min",
-    print int(times[len(times)-1][0]%60), "s", "at", str(times[len(times)-1][1])
-
-    all_times = 0
-    for i in times:
-        all_times += i[0]
-
-    print "Average time", int(round(all_times/len(times)/60)), "min",
-    print int(all_times/len(times)%60), "s"
-
-    total_hours = all_times/(60*60)
-    total_minutes = (all_times/(60*60) - int(total_hours))*60
-    total_seconds = (total_minutes - int(total_minutes))*60
-    print "In total spent", int(round(total_hours)), "h",
-    print int(round(total_minutes)), "min", int(round(total_seconds)),
-    print "s emerging", package
+    print package, "emerged", emerge_number, "time(s)"
+
+    if emerge_number == 1:
+        print "Emerge time", int(round(times[0][0]/60)), "min", int(times[0][0]%60),
+        print "s", "at", str(times[0][1])
+
+    else:
+        print "Max time", int(round(times[0][0]/60)), "min", int(times[0][0]%60),
+        print "s", "at", str(times[0][1])
+        print "Min time", int(round(times[len(times)-1][0]/60)), "min",
+        print int(times[len(times)-1][0]%60), "s", "at", str(times[len(times)-1][1])
+        
+        all_times = 0
+        for i in times:
+            all_times += i[0]
+
+        print "Average time", int(round(all_times/len(times)/60)), "min",
+        print int(all_times/len(times)%60), "s"
+
+        total_hours = all_times/(60*60)
+        total_minutes = (all_times/(60*60) - int(total_hours))*60
+        total_seconds = (total_minutes - int(total_minutes))*60
+        print "In total spent", int(round(total_hours)), "h",
+        print int(round(total_minutes)), "min", int(round(total_seconds)),
+        print "s emerging", package
 
 
 for line in f: