diff options
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 5a6dcd72f6..bb921fc98e 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -120,6 +120,24 @@ class Build(models.Model): | |||
120 | build_name = models.CharField(max_length=100) | 120 | build_name = models.CharField(max_length=100) |
121 | bitbake_version = models.CharField(max_length=50) | 121 | bitbake_version = models.CharField(max_length=50) |
122 | 122 | ||
123 | def completeper(self): | ||
124 | tf = Task.objects.filter(build = self) | ||
125 | tfc = tf.count() | ||
126 | if tfc > 0: | ||
127 | completeper = tf.exclude(order__isnull=True).count()*100/tf.count() | ||
128 | else: | ||
129 | completeper = 0 | ||
130 | return completeper | ||
131 | |||
132 | def eta(self): | ||
133 | from django.utils import timezone | ||
134 | eta = 0 | ||
135 | completeper = self.completeper() | ||
136 | if self.completeper() > 0: | ||
137 | eta = timezone.now() + ((timezone.now() - self.started_on)*(100-completeper)/completeper) | ||
138 | return eta | ||
139 | |||
140 | |||
123 | def get_sorted_target_list(self): | 141 | def get_sorted_target_list(self): |
124 | tgts = Target.objects.filter(build_id = self.id).order_by( 'target' ); | 142 | tgts = Target.objects.filter(build_id = self.id).order_by( 'target' ); |
125 | return( tgts ); | 143 | return( tgts ); |