@@ -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,31 @@ public function getTwigDataForProblemsAction(
10571058 foreach ($ samplesData as $ sample ) {
10581059 $ samples [$ sample ['probid ' ]] = $ sample ['numsamples ' ];
10591060 }
1061+
1062+ // Do not show any clars to the public.
1063+ $ juryOrValidTeam = $ forJury || $ contest ;
1064+ if ($ juryOrValidTeam ) {
1065+ $ raw_clars = $ this ->em ->createQueryBuilder ()
1066+ ->from (Clarification::class, 'clar ' )
1067+ ->select ('clar ' )
1068+ ->andWhere ('clar.contest = :cid ' )
1069+ // Only clars associated with a problem.
1070+ ->andWhere ('clar.problem IS NOT NULL ' )
1071+ // Only clars send from the jury.
1072+ ->andWhere ('clar.sender IS NULL ' )
1073+ // Only clars send to all teams or just this team.
1074+ ->andWhere ('clar.recipient IS NULL OR clar.recipient = :teamid ' )
1075+ ->setParameter ('cid ' , $ contest ->getCid ())
1076+ ->setParameter ('teamid ' , $ teamId )
1077+ ->orderBy ('clar.submittime ' , 'DESC ' )
1078+ ->getQuery ()
1079+ ->getResult ();
1080+
1081+ // Group clarifications by problem id.
1082+ foreach ($ raw_clars as $ clar ) {
1083+ $ clars [$ clar ->getProblem ()->getProbid ()][] = $ clar ;
1084+ }
1085+ }
10601086 }
10611087
10621088 $ data = [
@@ -1065,6 +1091,7 @@ public function getTwigDataForProblemsAction(
10651091 'showLimits ' => $ showLimits ,
10661092 'defaultMemoryLimit ' => $ defaultMemoryLimit ,
10671093 'timeFactorDiffers ' => $ timeFactorDiffers ,
1094+ 'clarifications ' => $ clars ,
10681095 ];
10691096
10701097 if ($ contest && $ this ->config ->get ('show_public_stats ' )) {
0 commit comments