@@ -1028,6 +1028,7 @@ public function getTwigDataForProblemsAction(
10281028
10291029 $ problems = [];
10301030 $ samples = [];
1031+ $ clars = [];
10311032 if ($ contest && ($ forJury || $ contest ->getFreezeData ()->started ())) {
10321033 $ problems = $ this ->em ->createQueryBuilder ()
10331034 ->from (ContestProblem::class, 'cp ' )
@@ -1057,6 +1058,27 @@ public function getTwigDataForProblemsAction(
10571058 foreach ($ samplesData as $ sample ) {
10581059 $ samples [$ sample ['probid ' ]] = $ sample ['numsamples ' ];
10591060 }
1061+
1062+ $ raw_clars = $ this ->em ->createQueryBuilder ()
1063+ ->from (Clarification::class, 'clar ' )
1064+ ->select ('clar ' )
1065+ ->andWhere ('clar.contest = :cid ' )
1066+ // Only clars associated with a problem.
1067+ ->andWhere ('clar.problem IS NOT NULL ' )
1068+ // Only clars send from the jury.
1069+ ->andWhere ('clar.sender IS NULL ' )
1070+ // Only clars send to all teams or just this team.
1071+ ->andWhere ('clar.recipient IS NULL OR clar.recipient = :teamid ' )
1072+ ->setParameter ('cid ' , $ contest ->getCid ())
1073+ ->setParameter ('teamid ' , $ teamId )
1074+ ->orderBy ('clar.submittime ' , 'DESC ' )
1075+ ->getQuery ()
1076+ ->getResult ();
1077+
1078+ // Group clarifications by problem id.
1079+ foreach ($ raw_clars as $ clar ) {
1080+ $ clars [$ clar ->getProblem ()->getProbid ()][] = $ clar ;
1081+ }
10601082 }
10611083
10621084 $ data = [
@@ -1065,6 +1087,7 @@ public function getTwigDataForProblemsAction(
10651087 'showLimits ' => $ showLimits ,
10661088 'defaultMemoryLimit ' => $ defaultMemoryLimit ,
10671089 'timeFactorDiffers ' => $ timeFactorDiffers ,
1090+ 'clarifications ' => $ clars ,
10681091 ];
10691092
10701093 if ($ contest && $ this ->config ->get ('show_public_stats ' )) {
0 commit comments