def generate_contracts(program_id): current_program = DatabaseManager.get_program(program_id) contract_date = request.form["contract_date"] if not is_current_program_set(current_program, config_parser): flash('Żeby wygenerować umowy ustaw program jako aktulany', 'error') elif not contract_date or contract_date == "dd.mm.rrrr": flash('Uzupełnij datę zawarcia umów', 'error') else: if session.get('program_id') == program_id: all_schols = DatabaseManager.get_all_schools() for school in all_schols: if school.nick != FILL_STR_SCHOOL: # Dont create contract for school with not full date filled new_contract = ContractCreator(school, session.get('program_id')) new_contract.create(DateConverter.to_date(contract_date)) flash("Umowy zostały wygenerowane pomyślnie", 'success') else: flash('Możesz wygnerować umowy tylko dla akutalnie wybranego programu', 'error') return render_template("program_form.html", Program=current_program)
def test_get_all_schools_is26(): assert (len(DatabaseManager.get_all_schools()) == 29)
def schools_all(): if not session.get('program_id'): return redirect(url_for('program')) all_schools = DatabaseManager.get_all_schools() return render_template("schools_all.html", Schools=all_schools, program_id=session.get('program_id'), invalid_school_id=INVALID_ID)