示例#1
0
 def _handle_request(self, req):
     title = 'Statistics'
     stats = find_current_stats(self.conn)
     basic = {
         'submissions': stats.get('submission.all', 0),
         'fingerprints': stats.get('fingerprint.all', 0),
         'tracks': stats.get('track.all', 0),
         'mbids': stats.get('mbid.all', 0),
         'puids': stats.get('puid.all', 0),
         'contributors': stats.get('account.active', 0),
         'mbids_both': stats.get('mbid.both', 0),
         'mbids_onlypuid': stats.get('mbid.onlypuid', 0),
         'mbids_onlyacoustid': stats.get('mbid.onlyacoustid', 0),
     }
     track_mbid = self._get_pie_chart(stats, 'track.%dmbids')
     mbid_track = self._get_pie_chart(stats, 'mbid.%dtracks')
     basic['tracks_with_mbid'] = basic['tracks'] - stats.get('track.0mbids', 0)
     basic['tracks_with_mbid_percent'] = percent(basic['tracks_with_mbid'], basic['tracks'])
     top_contributors = find_top_contributors(self.conn)
     daily_raw = find_daily_stats(self.conn, ['submission.all', 'fingerprint.all', 'track.all', 'mbid.all', 'puid.all'])
     daily = {
         'submissions': daily_raw['submission.all'],
         'fingerprints': daily_raw['fingerprint.all'],
         'tracks': daily_raw['track.all'],
         'mbids': daily_raw['mbid.all'],
         'puids': daily_raw['puid.all'],
     }
     lookups = find_lookup_stats(self.conn)
     return self.render_template('stats.html', title=title, basic=basic,
         track_mbid=track_mbid, mbid_track=mbid_track,
         top_contributors=top_contributors, daily=daily, lookups=lookups)
示例#2
0
def stats():
    title = 'Statistics'
    stats = find_current_stats(db.session.connection())
    basic = {
        'submissions': stats.get('submission.all', 0),
        'fingerprints': stats.get('fingerprint.all', 0),
        'tracks': stats.get('track.all', 0),
        'mbids': stats.get('mbid.all', 0),
        'contributors': stats.get('account.active', 0),
    }
    track_mbid = prepare_pie_chart_data(stats, 'track.%dmbids')
    mbid_track = prepare_pie_chart_data(stats, 'mbid.%dtracks')
    basic['tracks_with_mbid'] = basic['tracks'] - stats.get('track.0mbids', 0)
    basic['tracks_with_mbid_percent'] = percent(basic['tracks_with_mbid'],
                                                basic['tracks'])
    additions = find_daily_stats(db.session.connection(),
                                 ['track.all', 'mbid.all'])
    lookups = find_lookup_stats(db.session.connection())
    return render_template(
        'stats.html',
        title=title,
        basic=basic,
        track_mbid=track_mbid,
        mbid_track=mbid_track,
        additions_json=json.dumps(prepare_chart_data(additions)),
        lookups_json=json.dumps(prepare_chart_data(lookups)))
示例#3
0
def stats():
    title = 'Statistics'
    stats = find_current_stats(db.session.connection())
    basic = {
        'submissions': stats.get('submission.all', 0),
        'fingerprints': stats.get('fingerprint.all', 0),
        'tracks': stats.get('track.all', 0),
        'mbids': stats.get('mbid.all', 0),
        'contributors': stats.get('account.active', 0),
    }
    track_mbid = prepare_pie_chart_data(stats, 'track.%dmbids')
    mbid_track = prepare_pie_chart_data(stats, 'mbid.%dtracks')
    basic['tracks_with_mbid'] = basic['tracks'] - stats.get('track.0mbids', 0)
    basic['tracks_with_mbid_percent'] = percent(basic['tracks_with_mbid'], basic['tracks'])
    additions = find_daily_stats(db.session.connection(), ['track.all', 'mbid.all'])
    lookups = find_lookup_stats(db.session.connection())
    return render_template('stats.html', title=title, basic=basic,
        track_mbid=track_mbid, mbid_track=mbid_track,
        additions_json=json.dumps(prepare_chart_data(additions)),
        lookups_json=json.dumps(prepare_chart_data(lookups)))