def statistics_by_date(_month, _day, _year):
    chosen_date_array = {'year': _year, 'month': _month, 'day': _day}
    gs = GenerateStats()
    # Chosenyear, chosenmonth, chosenday
    # Fetch the data from the database.
    users = User.query.all()
    event = Tagevent
    default_date = datetime.now()
    selected_date = default_date.replace(day=int(_day), month=int(_month), year=int(_year))
    week_day_name = selected_date.strftime('%A')
    month_name = selected_date.strftime('%B')
    custom_date_day = {'weekday': week_day_name + ' ' + str(selected_date.day) + '/' + str(selected_date.month) + '/' + str(selected_date.year)}
    custom_date_month = {'month': month_name + ' ' + str(selected_date.year)}
    # Send the data to a method who returns an multi dimensional array with statistics.
    ret = gs.get_data(users, event, chosen_date_array)
    return render_template('statistics.html',
                           plot_paths='',
                           data=ret,
                           data2=custom_date_day,
                           data3=custom_date_month)
def statistics():
    default_date = datetime.now()
    default_date_array = {'year': str(default_date.year), 'month': str(default_date.strftime('%m')), 'day':str(default_date.strftime('%d'))}
    gs = GenerateStats()
    # Chosenyear, chosenmonth, chosenday
    # Fetch the data from the database.
    users = User.query.all()
    event = Tagevent
    week_day_name = default_date.strftime('%A')
    month_name = default_date.strftime('%B')
    custom_date_day = {'weekday': week_day_name + ' ' + str(default_date.day) + '/' + str(default_date.month) + '/' +
                       str(default_date.year)}
    custom_date_month = {'month': month_name + ' ' + str(default_date.year)}
    # Send the data to a method who returns an multi dimensional array with statistics.
    ret = gs.get_data(users, event, default_date_array)
    return render_template('statistics.html',
                           plot_paths='',
                           data=ret,
                           data2=custom_date_day,
                           data3=custom_date_month)