Added job count feed back on fleet list
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 14 Aug 2010 08:44:05 +0000 (08:44 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 14 Aug 2010 08:44:05 +0000 (08:44 +0000)
INSTALL
bin/djais/models.py
html_templates/fleets.html

diff --git a/INSTALL b/INSTALL
index de75a50cf963cac57b99af5d7aa14def27e66aeb..49b7cb76be4b616a7f70c5688f82b7dd31aa39bf 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -28,6 +28,8 @@ mkdir --mode 2775 /var/lib/ais/db/last
 mkdir --mode 2775 /var/lib/ais/stats/
 mkdir --mode 2775 /var/lib/ais/nmea/
 mkdir --mode 2775 /var/lib/ais/areas/
+mkdir --mode 2775 /var/lib/ais/cron/
+mkdir --mode 2775 /var/lib/ais/cron/fleets/
 mkdir /etc/ais/
 
 = Config
index aab78162f1e64833db04586c54373614ddb4bc87..9cb484d19f75613115369a5cbc5eaf9016f19612 100644 (file)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 
+import os, os.path
 from datetime import datetime
 from django.db import models
 from django.contrib.auth.models import get_hexdigest
@@ -111,6 +112,11 @@ class Fleet(models.Model):
         return FleetVessel.objects.filter(fleet=self.name).count()
     def user_count(self):
         return FleetUser.objects.filter(fleet=self.name).count()
+    def job_count(self):
+        if os.path.exists('/var/lib/ais/cron/fleets/%s.cron' % self.name):
+            return 1
+        else:
+            return 0
 
 class FleetUser(models.Model):
     id = models.AutoField(primary_key=True)
index 01e157ee3bc0f0113fa8eebb8633a9274e35341c..f869e4d71e4615290d915cd55f83d2f985f9ac0b 100644 (file)
 {% for fleetuser in fleetusers %}
 <a href='{{ fleetuser.fleet.name }}/' class=button>{{ fleetuser.fleet.name }}</a>{{ fleetuser.fleet.description }}
 <br>
-{{ fleetuser.fleet.vessel_count }} vessel{{ fleetuser.fleet.vessel_count|pluralize }} - {{ fleetuser.fleet.user_count }} user{{ fleetuser.fleet.user_count|pluralize }} <br>
+{{ fleetuser.fleet.vessel_count }} vessel{{ fleetuser.fleet.vessel_count|pluralize }} 
+- {{ fleetuser.fleet.user_count }} user{{ fleetuser.fleet.user_count|pluralize }}
+- {{ fleetuser.fleet.job_count }} periodic job{{ fleetuser.fleet.job_count|pluralize }}
+<br>
 
 <br><br>
 {% endfor %}