def get_all_project(): result = list() try: projects = ProjectModel.get_all_project() except Exception as e: print(e) return jsonify({ "message": "Có lỗi phát sinh trong server!", "code": 500 }), 500 for project in projects: check = StudentModel.get_data_by_project(project.id) result.append({ "id": project.id, "Ten": project.Ten, "Mota": project.MoTa, "TrangThai": project.TrangThai if not check else "Đã chọn", "GhiChu": project.GhiChu, "Cap": project.Cap }) return jsonify({ "message": "request thành công!", "data": result, "code": 200 }), 200
def get_all_project(): result = list() try: projects = ProjectModel.get_all_project() except Exception as e: print(e) return jsonify({ "message": "Có lỗi phát sinh trong server!", "code": 500 }), 500 for project in projects: result.append({ "id": project.id, "Ten": project.Ten, "Mota": project.MoTa, "TrangThai": project.TrangThai, "GhiChu": project.GhiChu }) return jsonify({ "message": "request thành công!", "data": result, "code": 200 }), 200