diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 191: Correct queued job query condition and a display name

Message ID 20120627091015.7683.81125.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Spring Zhang June 27, 2012, 9:10 a.m. UTC
Merge authors:
  Spring Zhang (qzhang)
Related merge proposals:
  https://code.launchpad.net/~qzhang/lava-scheduler/name-mistake/+merge/111988
  proposed by: Spring Zhang (qzhang)
  review: Approve - Spring Zhang (qzhang)
------------------------------------------------------------
revno: 191 [merge]
committer: Spring Zhang <spring.zhang@linaro.org>
branch nick: lava-scheduler
timestamp: Wed 2012-06-27 17:09:09 +0800
message:
  Correct queued job query condition and a display name
modified:
  lava_scheduler_app/views.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2012-06-16 04:08:20 +0000
+++ lava_scheduler_app/views.py	2012-06-26 01:49:31 +0000
@@ -26,6 +26,7 @@ 
 from django.utils.html import escape
 from django.utils.safestring import mark_safe
 from django.db import models
+from django.db.models import Q
 
 from django_tables2 import Attrs, Column
 
@@ -296,7 +297,7 @@ 
     The value is defined when table instance is created in device_type_detail()
     """
 
-    def render_name(self, record):
+    def render_Duration(self, record):
         matrix = {-24:"24hours", -24*7:"Week", -24*7*30:"Month"}
         return matrix[record]
 
@@ -315,7 +316,7 @@ 
                     TestJob.CANCELED, TestJob.CANCELING]).count()
         return num
 
-    name = Column()
+    Duration = Column()
     Complete = Column()
     Failed = Column()
 
@@ -343,11 +344,10 @@ 
             'running_jobs_num': TestJob.objects.filter(
                 actual_device__in=Device.objects.filter(device_type=dt),
                 status=TestJob.RUNNING).count(),
-            # Fix me: doesn't count actual_device not set but requested
-            # device type jobs.
             'queued_jobs_num': TestJob.objects.filter(
-                actual_device__in=Device.objects.filter(device_type=dt),
-                status=TestJob.SUBMITTED).count(),
+                Q(status=TestJob.SUBMITTED), Q(requested_device_type=dt)
+                | Q(requested_device__in=Device.objects.filter(device_type=dt))
+                ).count(),
             # data return 1 day, 1 week, 1 month offset
             'health_job_summary_table': HealthJobSummaryTable(
                 'device_type', params=(dt,), data=[-24, -24*7, -24*7*30]),