def get_stats(name): player = db.get_stats(name) if player is not None: return player #returns json_string #yell at onomancer if not in cache or too old response = _retry_session().get(onomancer_url + name_stats_hook + urllib.parse.quote_plus(name)) if response.status_code == 200: stats = json.dumps(response.json()) db.cache_stats(name, stats) return stats
def memAnalysis(): if( 'logged_in' not in session or not session['logged_in']): return redirect(url_for('login')) reports = database.get_stats() if reports is None: flash("Error, there are no users in the system") page['bar'] = False return(redirect(url_for('memAnalysis'))) return render_template('memberAnalysis.html', session=session, page=page, reports=reports, user=user_details)
def get_stats(): statsList = db.get_stats() if (len(statsList) == 0): return make_response(jsonify({'error': 'There are no stats of users in the database!'}), 404) else: return make_response(jsonify(statsList),200)
def get_voting_statistics(): stats = database.get_stats() return jsonify(stats=stats)