def formentry_plot_js(clinic_id, user_id): # there has to be a better way to do this data = entrytimes.get_data(clinic_id, user_id) totals_json, avgs_json = get_sparkline_json(data) return render_to_string("reports/partials/formentry_plot.js", {"avgs_data": avgs_json, "totals_data": totals_json, "chart_extras": get_sparkline_extras(data)})
def entrytime(request): clinic_id = request.GET.get("clinic", None) user_id = request.GET.get("user", None) user_data = {} data = {} name = "Form Entry Time Report" if clinic_id: user_data = get_users(clinic_id) if user_id: selected_user = [user for user, _ in user_data if user["_id"] == user_id][0] name = "Form Entry Time Report for %s at %s" % (render_user_inline(selected_user), clinic_display_name(clinic_id)) else: name = "Form Entry Time Report for %s (%s)" % (clinic_display_name(clinic_id), clinic_id) clinic_data = get_clinics() return render_to_response(request, "reports/entrytimes.html", {"report": {"name": name}, "chart_extras": get_sparkline_extras(data), "clinic_data": clinic_data, "user_data": user_data, "clinic_id": clinic_id, "user_id": user_id})