def report(id): with open("staff.json", encoding='utf-8') as write_file: data = json.loads(write_file.read()) data = data[id] p = Person() p.name = data['name'] p.patronymic = data['patronymic'] p.surname = data['surname'] p.tasks = data['tasks'] p.calc() p.doc() return url_for('static', filename='%s.pdf' % p.name)
def admin_report(): with open("staff.json", encoding='utf-8') as write_file: data = json.loads(write_file.read()) user_info = [] data_report = [['name', 'surname', 'patronymic', 'tasks']] print(data) for user in data: data_user = data[user] p = Person() p.name = data_user['name'] p.patronymic = data_user['patronymic'] p.surname = data_user['surname'] p.tasks = data_user['tasks'] p.calc() user_info.append(p.name) user_info.append(p.surname) user_info.append(p.patronymic) user_info.append(str(len(p.tasks))) data_report.append(user_info) user_info = [] print(data_report) admin_doc(data_report) return url_for('static', filename='admin.pdf')