def request_analytics_by_date(analytics_date): #redirect to date_error page is invalid date format if not isValidDate(analytics_date): return render_template('date_error.html') # create Analytics object and populate with analytics data. data = Analytics(analytics_date) data.get_analytics() # return the output dictionary in json format to the browser return jsonify(data.output)
def collection_and_analysis(data, is_analytic): entrants = [] for fio in data: entrant = EntrantApplications(fio) entrants.append(entrant) result = [] for entrant in entrants: result.append(entrant.fname) result.append('Согласие о зачислении подано на направление: ' + entrant.priority[1]) for direction in entrant.apps: result.append(direction[1]) result.append('') if is_analytic: analysis = Analytics(entrants) result.extend(analysis.get_analytics()) return result