28 import(
'classes.workflow.EditorDecisionActionsManager');
29 import(
'lib.pkp.classes.submission.PKPSubmission');
33 $accepted = $this->
countByDecisions(SUBMISSION_EDITOR_DECISION_ACCEPT, $args);
34 $declinedDesk = $this->
countByDecisions(SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE, $args);
35 $declinedReview = $this->
countByDecisions(SUBMISSION_EDITOR_DECISION_DECLINE, $args);
36 $declined = $declinedDesk + $declinedReview;
43 $declinedDeskRate = 0;
44 $declinedReviewRate = 0;
45 } elseif (empty($args[
'dateStart']) && empty($args[
'dateEnd'])) {
46 $acceptanceRate = $accepted / $received;
47 $declineRate = $declined / $received;
48 $declinedDeskRate = $declinedDesk / $received;
49 $declinedReviewRate = $declinedReview / $received;
62 $totalDecidedForSubmissionDate = $acceptedForSubmissionDate + $declinedDeskForSubmissionDate + $declinedReviewForSubmissionDate;
65 if (!$totalDecidedForSubmissionDate) {
68 $declinedDeskRate = 0;
69 $declinedReviewRate = 0;
71 $acceptanceRate = $acceptedForSubmissionDate / $totalDecidedForSubmissionDate;
72 $declineRate = ($declinedDeskForSubmissionDate + $declinedReviewForSubmissionDate) / $totalDecidedForSubmissionDate;
73 $declinedDeskRate = $declinedDeskForSubmissionDate / $totalDecidedForSubmissionDate;
74 $declinedReviewRate = $declinedReviewForSubmissionDate / $totalDecidedForSubmissionDate;
81 $acceptDecisionDays = $this->
getDaysToDecisions([SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION, SUBMISSION_EDITOR_DECISION_ACCEPT], $args);
82 $declineDecisionDays = $this->
getDaysToDecisions([SUBMISSION_EDITOR_DECISION_DECLINE, SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE], $args);
89 'key' =>
'submissionsReceived',
90 'name' =>
'stats.name.submissionsReceived',
94 'key' =>
'submissionsAccepted',
95 'name' =>
'stats.name.submissionsAccepted',
99 'key' =>
'submissionsDeclined',
100 'name' =>
'stats.name.submissionsDeclined',
101 'value' => $declined,
104 'key' =>
'submissionsDeclinedDeskReject',
105 'name' =>
'stats.name.submissionsDeclinedDeskReject',
106 'value' => $declinedDesk,
109 'key' =>
'submissionsDeclinedPostReview',
110 'name' =>
'stats.name.submissionsDeclinedPostReview',
111 'value' => $declinedReview,
114 'key' =>
'submissionsPublished',
115 'name' =>
'stats.name.submissionsPublished',
119 'key' =>
'daysToDecision',
120 'name' =>
'stats.name.daysToDecision',
121 'value' => $firstDecisionDaysRate,
124 'key' =>
'daysToAccept',
125 'name' =>
'stats.name.daysToAccept',
126 'value' => $acceptDecisionDaysRate,
129 'key' =>
'daysToReject',
130 'name' =>
'stats.name.daysToReject',
131 'value' => $declineDecisionDaysRate,
134 'key' =>
'acceptanceRate',
135 'name' =>
'stats.name.acceptanceRate',
136 'value' => round($acceptanceRate, 2),
139 'key' =>
'declineRate',
140 'name' =>
'stats.name.declineRate',
141 'value' => round($declineRate, 2),
144 'key' =>
'declinedDeskRate',
145 'name' =>
'stats.name.declinedDeskRate',
146 'value' => round($declinedDeskRate, 2),
149 'key' =>
'declinedReviewRate',
150 'name' =>
'stats.name.declinedReviewRate',
151 'value' => round($declinedReviewRate, 2),
178 import(
'classes.workflow.EditorDecisionActionsManager');
179 import(
'lib.pkp.classes.submission.PKPSubmission');
181 unset($args[
'dateStart']);
182 unset($args[
'dateEnd']);
186 $receivedDates = $this->
getQueryBuilder($args)->getSubmissionsReceivedDates();
187 if (empty($receivedDates[0])) {
190 $yearStart = ((int) substr($receivedDates[0], 0, 4)) + 1;
191 $yearEnd = (int) substr($receivedDates[1], 0, 4);
192 if ($yearEnd >= date(
'Y')) {
195 $years = ($yearEnd - $yearStart) + 1;
197 $argsReceived = array_merge(
200 'dateStart' => sprintf(
'%s-01-01', $yearStart),
201 'dateEnd' => sprintf(
'%s-12-31', $yearEnd),
210 'submissionsAccepted' => [SUBMISSION_EDITOR_DECISION_ACCEPT],
211 'submissionsDeclined' => [SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE, SUBMISSION_EDITOR_DECISION_DECLINE],
212 'submissionsDeclinedDeskReject' => [SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE],
213 'submissionsDeclinedPostReview' => [SUBMISSION_EDITOR_DECISION_DECLINE],
215 $yearlyDecisions = [];
216 foreach ($decisionsList as $key => $decisions) {
219 if (empty($dates[0])) {
222 $yearStart = ((int) substr($dates[0], 0, 4)) + 1;
223 $yearEnd = (int) substr($dates[1], 0, 4);
224 if ($yearEnd >= date(
'Y')) {
227 $years = ($yearEnd - $yearStart) + 1;
229 $argsYearly = array_merge(
232 'dateStart' => sprintf(
'%s-01-01', $yearStart),
233 'dateEnd' => sprintf(
'%s-12-31', $yearEnd),
239 $yearlyDecisions[$key] = $yearly;
245 if (empty($publishedDates[0])) {
248 $yearStart = ((int) substr($publishedDates[0], 0, 4)) + 1;
249 $yearEnd = (int) substr($publishedDates[1], 0, 4);
250 if ($yearEnd >= date(
'Y')) {
253 $years = ($yearEnd - $yearStart) + 1;
255 $argsPublished = array_merge(
258 'dateStart' => sprintf(
'%s-01-01', $yearStart),
259 'dateEnd' => sprintf(
'%s-12-31', $yearEnd),
266 $averages = array_merge(
267 [
'submissionsReceived' => $received],
269 [
'submissionsPublished' => $published]
315 return $this->
getQueryBuilder($args)->countByDecisions((array) $decisions);
330 return $this->
getQueryBuilder($args)->countByDecisions((array) $decisions,
true);
344 return $this->
getQueryBuilder($args)->countByStatus((array) $statuses);
358 return $this->
getQueryBuilder($args)->countActiveByStages((array) $stages);
374 return $this->
getQueryBuilder($args)->getDaysToDecisions((array) $decisions);
410 $arrayPart = array_slice($days, 0, ceil(count($days) * $percentage));
411 return end($arrayPart) ?? 0;
426 $qb = new \APP\Services\QueryBuilders\StatsEditorialQueryBuilder();
428 if (!empty($args[
'dateStart'])) {
429 $qb->after($args[
'dateStart']);
431 if (!empty($args[
'dateEnd'])) {
432 $qb->before($args[
'dateEnd']);
434 if (!empty($args[
'contextIds'])) {
435 $qb->filterByContexts($args[
'contextIds']);