Get open surveys for rater.
51 : array {
52
53 $appraisees = $this->appr_repo->getAppraiseesForRater($rater_user_id);
54
55
56 $finished_ids = array_map(static function (array $i): string {
57 return $i["survey_id"] . ":" . $i["appr_id"];
58 }, $this->run_repo->getFinishedAppraiseesForRater($rater_user_id));
59 $open_appraisees = array_filter($appraisees, static function (array $i) use ($finished_ids): bool {
60 return !in_array($i["survey_id"] . ":" . $i["appr_id"], $finished_ids, true);
61 });
62
63
64 $open_surveys = array_unique(array_column($open_appraisees, "survey_id"));
65
66
67 $closed_appr = $this->appr_repo->getClosedAppraiseesForSurveys($open_surveys);
68 $closed_appr_ids = array_map(static function (array $i): string {
69 return $i["survey_id"] . ":" . $i["appr_id"];
70 }, $closed_appr);
71
72 $open_appraisees = array_filter($open_appraisees, static function (array $i) use ($closed_appr_ids): bool {
73 return !in_array($i["survey_id"] . ":" . $i["appr_id"], $closed_appr_ids, true);
74 });
75 $open_surveys = array_unique(array_column($open_appraisees, "survey_id"));
76
77
78 $has_ended = $this->set_repo->hasEnded($open_surveys);
79 $open_surveys = array_filter($open_surveys, static function (int $i) use ($has_ended): bool {
80 return !($has_ended[$i] ?? false);
81 });
82
83 return $open_surveys;
84 }