Created
August 10, 2016 09:47
-
-
Save miedzwin/b2b01112f112ae76154c4bbe74b8fc9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getEvaluationsAction(Request $request, $teachingGroupLessonMaterialId) | |
{ | |
$em = $this->getDoctrine()->getManager(); | |
$user = $this->getUser(); | |
$studentTeachingGroupLessonMaterialRepo = $em->getRepository(StudentTeachingGroupLessonMaterial::class); | |
$studentTeachingGroupLessonMaterialsOld = $studentTeachingGroupLessonMaterialRepo->getStudentsByTeachingGroupLessonMaterialIdAndTeacherId($teachingGroupLessonMaterialId, $user->getId()); | |
if (is_null($studentTeachingGroupLessonMaterialsOld)) { | |
throw $this->createNotFoundException(); | |
} | |
//if ($request->isXmlHttpRequest()) { | |
$status = null; | |
for ($i = 0; $i < 15; $i++) { | |
sleep(1); | |
$studentTeachingGroupLessonMaterialsNew = $studentTeachingGroupLessonMaterialRepo->getStudentsByTeachingGroupLessonMaterialIdAndTeacherId($teachingGroupLessonMaterialId, $user->getId()); | |
foreach ($studentTeachingGroupLessonMaterialsOld as $old) { | |
dump($old->getResult()); | |
} | |
foreach ($studentTeachingGroupLessonMaterialsNew as $new) { | |
dump($new->getResult()); | |
} | |
dump($studentTeachingGroupLessonMaterialsNew != $studentTeachingGroupLessonMaterialsOld); | |
if ($studentTeachingGroupLessonMaterialsNew != $studentTeachingGroupLessonMaterialsOld) { | |
$studentTeachingGroupLessonMaterialsOld = $studentTeachingGroupLessonMaterialsNew; | |
$status = 'update'; | |
break; | |
} | |
} | |
die(); | |
if (!is_null($status)) { | |
$template = $this->renderView(':logged_in/teacher/teachingGroup/evaluation:evaluationTable.html.twig', [ | |
'studentTeachingGroupLessonMaterials' => $studentTeachingGroupLessonMaterialsOld, | |
'teachingGroupLessonMaterialId' => $teachingGroupLessonMaterialId, | |
]); | |
return new JsonResponse([ | |
'status' => $status, | |
'template' => $template, | |
]); | |
} | |
return new JsonResponse([ | |
'status' => 'ok', | |
]); | |
//} | |
return $this->render(':logged_in/teacher/teachingGroup/evaluation:evaluationTable.html.twig', [ | |
'studentTeachingGroupLessonMaterials' => $studentTeachingGroupLessonMaterialsOld, | |
'teachingGroupLessonMaterialId' => $teachingGroupLessonMaterialId, | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment