IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 26, 2011, 1:22:07 PM (15 years ago)
Author:
rhenders
Message:

added seconds to method get time of last publish. stacks are fast

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/ipptopspsdb.py

    r32443 r32452  
    300300    '''
    301301    def getStages(self):
    302         return ['processed', 'loaded_to_datastore', 'loaded_to_ODM', 'merge_worthy', 'deleted_datastore', 'merged', 'deleted_dxlayer', 'deleted_local']
     302        return ['processed', 'loaded_to_datastore', 'loaded_to_ODM', 'merge_worthy', 'merged', 'deleted_datastore', 'deleted_dxlayer', 'deleted_local']
    303303
    304304    '''
     
    330330        minutes = None
    331331
    332         sql = "SELECT TIMESTAMPDIFF(MINUTE, timestamp, now()) \
     332        sql = "SELECT TIMESTAMPDIFF(SECOND, timestamp, now()) \
    333333               FROM batch \
    334334               WHERE batch_type = '" + batchType + "' \
     
    340340        try:
    341341            rs = self.executeQuery(sql)
    342             if rs.first(): minutes = rs.getFloat(1)
     342            if rs.first(): seconds = rs.getFloat(1)
    343343        except:
    344344            self.logger.exception("Unable to get last batch published")
    345345
    346         if not minutes: return "Never"
    347 
     346        if not seconds: return "Never"
     347
     348        minutes = seconds/60.0
    348349        hours = minutes/60.0
    349350        days = hours/24.0
    350351        weeks = days/7.0
    351352
    352         if minutes < 60: return "%.1f mins ago" % minutes
     353        if seconds < 60: return "%.1f secs ago" % seconds
     354        elif minutes < 60: return "%.1f mins ago" % minutes
    353355        elif hours < 48: return "%.1f hours ago" % hours
    354356        elif days < 7: return "%.1f days ago" % days
Note: See TracChangeset for help on using the changeset viewer.