Skip to content

Commit 8d06131

Browse files
committed
chore: reduce log noise Presentation::getSelectionStatus
1 parent c48af63 commit 8d06131

1 file changed

Lines changed: 11 additions & 90 deletions

File tree

app/Models/Foundation/Summit/Events/Presentations/Presentation.php

Lines changed: 11 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -953,12 +953,10 @@ public function setAttendingMedia($attending_media)
953953
public function getSelectionStatus()
954954
{
955955

956-
Log::debug(sprintf("Presentation::getSelectionStatus presentation %s", $this->id));
957-
958-
$session_sel = $this->createQuery("SELECT sp from models\summit\SummitSelectedPresentation sp
956+
$session_sel = $this->createQuery("SELECT sp from models\summit\SummitSelectedPresentation sp
959957
JOIN sp.list l
960958
JOIN sp.presentation p
961-
WHERE p.id = :presentation_id
959+
WHERE p.id = :presentation_id
962960
AND sp.collection = :collection
963961
AND l.list_type = :list_type
964962
AND l.list_class = :list_class")
@@ -973,121 +971,44 @@ public function getSelectionStatus()
973971
}
974972

975973
if ($this->isPublished()) {
976-
Log::debug
977-
(
978-
sprintf
979-
(
980-
"Presentation::getSelectionStatus presentation %s return %s ( is published ).",
981-
$this->id,
982-
Presentation::SelectionStatus_Accepted
983-
)
984-
);
985-
986974
return Presentation::SelectionStatus_Accepted;
987975
}
988976

989977
// from here we need to be sure that the selection period is going on or it is over
990978

991979
$selection_plan = $this->getSelectionPlan();
992980
if (is_null($selection_plan)) {
993-
Log::debug
994-
(
995-
sprintf
996-
(
997-
"Presentation::getSelectionStatus presentation %s return %s ( has no selection plan ).",
998-
$this->id,
999-
Presentation::SelectionStatus_Pending
1000-
)
1001-
);
1002981
return Presentation::SelectionStatus_Pending;
1003982
}
1004983
if (!$selection_plan->hasSelectionPeriodDefined()) {
1005-
1006-
Log::debug
1007-
(
1008-
sprintf
1009-
(
1010-
"Presentation::getSelectionStatus presentation %s return %s ( selection plan hasSelectionPeriodDefined ).",
1011-
$this->id,
1012-
Presentation::SelectionStatus_Pending
1013-
)
1014-
);
1015984
return Presentation::SelectionStatus_Pending;
1016985
}
1017986
if ($selection_plan->isSelectionNotYetStarted()) {
1018-
1019-
Log::debug
1020-
(
1021-
sprintf
1022-
(
1023-
"Presentation::getSelectionStatus presentation %s return %s ( selection plan isSelectionNotYetStarted ).",
1024-
$this->id,
1025-
Presentation::SelectionStatus_Pending
1026-
)
1027-
);
1028987
return Presentation::SelectionStatus_Pending;
1029988
}
1030989

1031990
$selection = null;
1032991
if (count($session_sel) == 1) {
1033992
$selection = $session_sel[0];
1034-
Log::debug
1035-
(
1036-
sprintf
1037-
(
1038-
"Presentation::getSelectionStatus presentation %s got selection %s",
1039-
$this->id,
1040-
$selection->getId()
1041-
)
1042-
);
1043993
}
1044994

1045995
if (!$selection) {
1046-
Log::debug
1047-
(
1048-
sprintf
1049-
(
1050-
"Presentation::getSelectionStatus presentation %s return %s ( not selected ).",
1051-
$this->id,
1052-
Presentation::SelectionStatus_Unaccepted
1053-
)
1054-
);
1055996
return Presentation::SelectionStatus_Unaccepted;
1056997
}
1057998

1058999
if ($selection->getOrder() <= $this->getCategory()->getSessionCount()) {
1059-
Log::debug
1060-
(
1061-
sprintf
1062-
(
1063-
"Presentation::getSelectionStatus presentation %s return %s ( selection order is %s from %s ).",
1064-
$this->id,
1065-
Presentation::SelectionStatus_Accepted,
1066-
$selection->getOrder(),
1067-
$this->getCategory()->getSessionCount()
1068-
)
1069-
);
10701000
return Presentation::SelectionStatus_Accepted;
10711001
}
10721002

1073-
Log::debug
1074-
(
1075-
sprintf
1076-
(
1077-
"Presentation::getSelectionStatus presentation %s return %s ( default ).",
1078-
$this->id,
1079-
Presentation::SelectionStatus_Alternate
1080-
)
1081-
);
10821003
return Presentation::SelectionStatus_Alternate;
10831004
}
10841005

10851006
public function getRank(): ?int
10861007
{
1087-
$session_sel = $this->createQuery("SELECT sp from models\summit\SummitSelectedPresentation sp
1008+
$session_sel = $this->createQuery("SELECT sp from models\summit\SummitSelectedPresentation sp
10881009
JOIN sp.list l
10891010
JOIN sp.presentation p
1090-
WHERE p.id = :presentation_id
1011+
WHERE p.id = :presentation_id
10911012
AND sp.collection = :collection
10921013
AND l.list_type = :list_type
10931014
AND l.list_class = :list_class")
@@ -1553,10 +1474,10 @@ public function viewedBy(Member $member): bool
15531474
*/
15541475
public function isGroupSelected($list_class = SummitSelectedPresentationList::Session): bool
15551476
{
1556-
return $this->createQuery("SELECT COUNT(sp.id) from models\summit\SummitSelectedPresentation sp
1477+
return $this->createQuery("SELECT COUNT(sp.id) from models\summit\SummitSelectedPresentation sp
15571478
JOIN sp.list l
15581479
JOIN sp.presentation p
1559-
WHERE p.id = :presentation_id
1480+
WHERE p.id = :presentation_id
15601481
AND sp.collection = :collection
15611482
AND l.list_type = :list_type
15621483
AND l.list_class = :list_class")
@@ -1700,7 +1621,7 @@ public function getPassersCount(): int
17001621
*/
17011622
public function getVotesTotalPoints(): int
17021623
{
1703-
$res = $this->createQuery("SELECT SUM(v.vote) from models\summit\PresentationVote v
1624+
$res = $this->createQuery("SELECT SUM(v.vote) from models\summit\PresentationVote v
17041625
JOIN v.presentation p
17051626
WHERE p.id = :presentation_id")
17061627
->setParameter('presentation_id', $this->id)->getSingleScalarResult();
@@ -1713,7 +1634,7 @@ public function getVotesTotalPoints(): int
17131634
public function getVotesCount(): int
17141635
{
17151636

1716-
$res = $this->createQuery("SELECT COUNT(v.id) from models\summit\PresentationVote v
1637+
$res = $this->createQuery("SELECT COUNT(v.id) from models\summit\PresentationVote v
17171638
JOIN v.presentation p
17181639
WHERE p.id = :presentation_id")
17191640
->setParameter('presentation_id', $this->id)->getSingleScalarResult();
@@ -1725,7 +1646,7 @@ public function getVotesCount(): int
17251646
*/
17261647
public function getVotesAverage(): float
17271648
{
1728-
$res = $this->createQuery("SELECT AVG(v.vote) from models\summit\PresentationVote v
1649+
$res = $this->createQuery("SELECT AVG(v.vote) from models\summit\PresentationVote v
17291650
JOIN v.presentation p
17301651
WHERE p.id = :presentation_id")
17311652
->setParameter('presentation_id', $this->id)->getSingleScalarResult();
@@ -2263,8 +2184,8 @@ public function getTrackChairAvgScoresPerRakingType(): array
22632184
Log::debug(sprintf("Presentation::getTrackChairAvgScoresPerRakingType presentation %s", $this->getId()));
22642185

22652186
$query = <<<SQL
2266-
SELECT
2267-
AVG(PresentationTrackChairScoreType.Score) avg_score,
2187+
SELECT
2188+
AVG(PresentationTrackChairScoreType.Score) avg_score,
22682189
PresentationTrackChairRatingType.ID AS ranking_type_id
22692190
FROM PresentationTrackChairScore
22702191
INNER JOIN PresentationTrackChairScoreType on PresentationTrackChairScoreType.ID = PresentationTrackChairScore.TypeID

0 commit comments

Comments
 (0)