Changeset 51b2f73 in osmose-frontend


Ignore:
Timestamp:
May 1, 2015 6:37:13 PM (2 years ago)
Author:
Frederic Rodrigo <fred.rodrigo@…>
Parents:
6b81d43
Message:

Display backend version

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • control.py

    r8c3397b r51b2f73  
    133133    MAX(EXTRACT(EPOCH FROM ((now())-dynpoi_update_last.timestamp))) AS max_age, 
    134134    MIN(EXTRACT(EPOCH FROM ((now())-dynpoi_update_last.timestamp))) AS min_age, 
     135    MAX(dynpoi_update.version) AS max_version, 
     136    MIN(dynpoi_update.version) AS min_version, 
    135137    count(*) AS count 
    136138FROM 
     
    150152 
    151153    summary = defaultdict(list) 
     154    max_versions = defaultdict(list) 
     155    min_versions = defaultdict(list) 
    152156    for res in db.fetchall(): 
    153         (remote, country, max_age, min_age, count) = res 
     157        (remote, country, max_age, min_age, max_version, min_version, count) = res 
    154158        summary[remote].append({'country': country, 'max_age': max_age/60/60/24, 'min_age': min_age/60/60/24, 'count': count}) 
    155  
    156     return template('control/updates_summary', summary=summary) 
     159        max_versions[remote].append(max_version) 
     160        min_versions[remote].append(min_version) 
     161    for remote in max_versions.keys(): 
     162        max_versions[remote] = max(max_versions[remote]) 
     163        if max_versions[remote] and '-' in max_versions[remote]: 
     164          max_versions[remote] = '-'.join(max_versions[remote].split('-')[1:5]) 
     165        min_versions[remote] = min(min_versions[remote]) 
     166        if min_versions[remote] and '-' in min_versions[remote]: 
     167          min_versions[remote] = '-'.join(min_versions[remote].split('-')[1:5]) 
     168 
     169    return template('control/updates_summary', summary=summary, max_versions=max_versions, min_versions=min_versions) 
    157170 
    158171 
    159172@route('/control/update/<source:int>') 
    160173def update(db, lang, source=None): 
    161     sql = "SELECT source,timestamp,remote_url,remote_ip FROM dynpoi_update WHERE source=%d ORDER BY timestamp DESC;" % source 
     174    sql = "SELECT source,timestamp,remote_url,remote_ip,version FROM dynpoi_update WHERE source=%d ORDER BY timestamp DESC;" % source 
    162175    db.execute(sql) 
    163176    return template('control/update', liste=db.fetchall()) 
  • views/control/update.tpl

    r6b53ea4 r51b2f73  
    55    <th style="min-width: 800px">{{_("remote url")}}</td> 
    66    <th>{{_("timestamp")}}</td> 
     7    <th>{{_("version")}}</td> 
    78</tr> 
    89%for res in liste: 
     
    1718    <td>{{url}}</td> 
    1819    <td>{{res[1]}}</td> 
     20    <td>{{res[4]}}</td> 
    1921</tr> 
    2022%end 
  • views/control/updates_summary.tpl

    rbfc41dc r51b2f73  
    1212<table> 
    1313%for remote in summary.keys(): 
    14 <tr><th><a href="update_matrix?remote={{remote}}">{{remote}}</a></th></tr> 
     14<tr><th><a href="update_matrix?remote={{remote}}">{{remote}}</a> ({{min_versions[remote]}} - {{max_versions[remote]}})</th></tr> 
    1515<tr><td> 
    1616%    for country in summary[remote]: 
Note: See TracChangeset for help on using the changeset viewer.