lib/cloud_crowd/models/job.rb in documentcloud-cloud-crowd-0.2.1 vs lib/cloud_crowd/models/job.rb in documentcloud-cloud-crowd-0.2.2

- old
+ new

@@ -112,10 +112,12 @@ # large input that takes a long time to split, and when it finally does it # creates a whole swarm of work units. This seems unavoidable. def percent_complete return 99 if merging? return 100 if complete? - (work_units.complete.count / work_units.count.to_f * 100).round + unit_count = work_units.count + return 100 if unit_count <= 0 + (work_units.complete.count / unit_count.to_f * 100).round end # How long has this Job taken? def time_taken return self.time if self.time \ No newline at end of file