Skip to content

Commit

Permalink
pkp#2612 Add submission filter for overdue review assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Aug 14, 2017
1 parent 949dca9 commit 48815b7
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 13 deletions.
1 change: 1 addition & 0 deletions api/v1/_submissions/PKPBackendSubmissionsHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public function getSubmissions($slimRequest, $response, $args) {
break;

case 'isIncomplete':
case 'isOverdue':
$params[$param] = true;
}
}
Expand Down
6 changes: 4 additions & 2 deletions classes/services/PKPSubmissionService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function getSubmissionList($contextId, $args = array()) {
'count' => 20,
'offset' => 0,
'isIncomplete' => false,
'isOverdue' => false,
);

$args = array_merge($defaultArgs, $args);
Expand All @@ -67,6 +68,7 @@ public function getSubmissionList($contextId, $args = array()) {
->filterByStatus($args['status'])
->filterByStageIds($args['stageIds'])
->filterByIncomplete($args['isIncomplete'])
->filterByOverdue($args['isOverdue'])
->searchPhrase($args['searchPhrase']);

\HookRegistry::call('Submission::getSubmissionList::queryBuilder', array(&$submissionListQB, $contextId, $args));
Expand Down Expand Up @@ -511,7 +513,7 @@ public function toArrayStageDetails($submission, $stageIds = null) {
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
$reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId);
if ($reviewRound) {
$stage['statusId'] = $reviewRound->getStatus();
$stage['statusId'] = $reviewRound->determineStatus();
$stage['status'] = __($reviewRound->getStatusKey());

// Revision files in this round.
Expand Down Expand Up @@ -565,7 +567,7 @@ public function toArrayReviewRounds($submission) {
'id' => $reviewRound->getId(),
'round' => $reviewRound->getRound(),
'stageId' => $reviewRound->getStageId(),
'statusId' => $reviewRound->getStatus(),
'statusId' => $reviewRound->determineStatus(),
'status' => __($reviewRound->getStatusKey()),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ abstract class PKPSubmissionListQueryBuilder extends BaseQueryBuilder {
/** @var bool whether to return only incomplete results */
protected $isIncomplete = false;

/** @var bool whether to return only submissions with overdue review assignments */
protected $isOverdue = false;

/**
* Constructor
*
Expand Down Expand Up @@ -121,6 +124,18 @@ public function filterByIncomplete($isIncomplete) {
return $this;
}

/**
* Set overdue submissions filter
*
* @param boolean $isOverdue
*
* @return \OJS\Services\QueryBuilders\SubmissionListQueryBuilder
*/
public function filterByOverdue($isOverdue) {
$this->isOverdue = $isOverdue;
return $this;
}

/**
* Limit results to a specific user's submissions
*
Expand Down Expand Up @@ -196,6 +211,23 @@ public function get() {
$q->where('s.submission_progress', '>', 0);
}

// overdue submisions
if ($this->isOverdue) {
$q->leftJoin('review_assignments as raod', 'raod.submission_id', '=', 's.submission_id')
->leftJoin('review_rounds as rr', function($table) {
$table->on('rr.submission_id', '=', 's.submission_id');
$table->on('raod.review_round_id', '=', 'rr.review_round_id');
});
// Only get overdue assignments on active review rounds
import('lib.pkp.classes.submission.reviewRound.ReviewRound');
$q->where('rr.status', '!=', REVIEW_ROUND_STATUS_RESUBMITTED);
$q->where('rr.status', '!=', REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL);
$q->where('rr.status', '!=', REVIEW_ROUND_STATUS_ACCEPTED);
$q->where('rr.status', '!=', REVIEW_ROUND_STATUS_DECLINED);
$q->where('raod.date_due', '<', \Core::getCurrentDate(strtotime('tomorrow')));
$q->where('raod.date_response_due', '<', \Core::getCurrentDate(strtotime('tomorrow')));
}

// assigned to
if (!is_null($this->assigneeId) && ($this->assigneeId !== -1)) {
$assigneeId = $this->assigneeId;
Expand Down
2 changes: 1 addition & 1 deletion classes/submission/reviewRound/ReviewRound.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function determineStatus() {
* @return int
*/
function getStatusKey($isAuthor = false) {
switch ($this->getStatus()) {
switch ($this->determineStatus()) {
case REVIEW_ROUND_STATUS_REVISIONS_REQUESTED:
return 'editor.submission.roundStatus.revisionsRequested';
case REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED:
Expand Down
16 changes: 11 additions & 5 deletions controllers/list/submissions/PKPSubmissionsListHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,24 @@ public function getConfig() {
$config['getParams'] = $this->_getParams;

$config['filters'] = array(
'stageIds' => array(
'heading' => __('settings.roles.stages'),
'filters' => $this->getWorkflowStages(),
),
'isIncomplete' => array(
'attention' => array(
'filters' => array(
array(
'param' => 'isOverdue',
'val' => true,
'title' => __('common.overdue'),
),
array(
'param' => 'isIncomplete',
'val' => true,
'title' => __('submissions.incomplete'),
),
),
),
'stageIds' => array(
'heading' => __('settings.roles.stages'),
'filters' => $this->getWorkflowStages(),
),
);

// Load grid localisation files
Expand Down
10 changes: 5 additions & 5 deletions js/controllers/list/submissions/SubmissionsListFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
{{ i18n.filter }}
</div>
<div class="pkpListPanel__filterOptions pkpListPanel__filterOptions--submissions">
<div v-for="(filter, param) in filters" class="pkpListPanel__filterSet">
<div v-for="filter in filters" class="pkpListPanel__filterSet">
<div v-if="filter.heading" class="pkpListPanel__filterSetLabel">
{{ filter.heading }}
</div>
<ul>
<li v-for="filterItem in filter.filters">
<a href="#"
@click.prevent.stop="filterBy(param, filterItem.val)"
@click.prevent.stop="filterBy(filterItem.param, filterItem.val)"
class="pkpListPanel__filterLabel"
:class="{'--isActive': isFilterActive(param, filterItem.val)}"
:class="{'--isActive': isFilterActive(filterItem.param, filterItem.val)}"
:tabindex="tabIndex"
>{{ filterItem.title }}</a>
<button
v-if="isFilterActive(param, filterItem.val)"
v-if="isFilterActive(filterItem.param, filterItem.val)"
href="#"
class="pkpListPanel__filterRemove"
@click.prevent.stop="clearFilter(param, filterItem.val)"
@click.prevent.stop="clearFilter(filterItem.param, filterItem.val)"
>
<span class="fa fa-times-circle-o"></span>
<span class="pkpListPanel__filterRemoveLabel">{{ __('filterRemove', {filterTitle: filterItem.title}) }}</span>
Expand Down

0 comments on commit 48815b7

Please sign in to comment.