Skip to content

Commit

Permalink
A paper can report when it's being updated
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Oct 1, 2024
1 parent 51e408d commit 33c1f4f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
32 changes: 27 additions & 5 deletions src/paperinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@ class PaperInfo {
const MARK_INACTIVE_PAUSE = 0x300;
const ALLOW_ABSENT = 0x400;
const IS_NEW = 0x800;
const HAS_WANT_SUBMITTED = 0x1000;
const WANT_SUBMITTED = 0x2000;
const IS_UPDATING = 0x1000;
const UPDATING_WANT_SUBMITTED = 0x2000;
const HAS_PHASE = 0x8000;
const PHASE_MASK = 0xF0000;
const PHASE_SHIFT = 16;
Expand Down Expand Up @@ -1079,18 +1079,40 @@ function is_new() {
return ($this->_flags & self::IS_NEW) !== 0;
}

/** @param bool $is_new */
/** @return bool */
function is_updating() {
return ($this->_flags & self::IS_UPDATING) !== 0;
}

/** @param bool $want_submitted
* @return $this */
function set_updating($want_submitted) {
assert(($this->_flags & self::IS_UPDATING) === 0);
$this->_flags |= self::IS_UPDATING
| ($want_submitted ? self::UPDATING_WANT_SUBMITTED : 0);
return $this;
}

/** @return $this */
function clear_updating() {
$this->_flags &= ~(self::IS_UPDATING | self::UPDATING_WANT_SUBMITTED);
return $this;
}

/** @param bool $is_new
* @return $this */
function set_is_new($is_new) {
$this->_flags &= ~self::IS_NEW;
if ($is_new) {
$this->_flags |= self::IS_NEW;
}
return $this;
}

/** @return bool */
function want_submitted() {
if (($this->_flags & self::HAS_WANT_SUBMITTED) !== 0) {
return ($this->_flags & self::WANT_SUBMITTED) !== 0;
if (($this->_flags & self::IS_UPDATING) !== 0) {
return ($this->_flags & self::UPDATING_WANT_SUBMITTED) !== 0;
} else {
return $this->timeSubmitted > 0;
}
Expand Down
4 changes: 3 additions & 1 deletion src/paperstatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -1177,9 +1177,9 @@ private function _normalize_and_check($pj) {
if ($this->has_error()) {
return false;
}
$this->prow->set_want_submitted($pj->status->submitted && !$pj->status->withdrawn);

// check fields
$this->prow->set_updating($pj->status->submitted && !$pj->status->withdrawn);
foreach ($this->prow->form_fields() as $opt) {
$this->_check_field($pj, $opt);
}
Expand All @@ -1188,6 +1188,7 @@ private function _normalize_and_check($pj) {
$this->warning_at("options", $this->_("<0>Ignoring unknown fields {:list}", $this->_unknown_fields));
}
if ($this->problem_status() >= MessageSet::ESTOP) {
$this->prow->clear_updating();
return false;
}

Expand All @@ -1200,6 +1201,7 @@ private function _normalize_and_check($pj) {
$this->_prepare_status($pj);
$this->_prepare_decision($pj);
$this->_prepare_final_status($pj);
$this->prow->clear_updating();

// correct blindness setting
if ($this->conf->submission_blindness() !== Conf::BLIND_OPTIONAL) {
Expand Down

0 comments on commit 33c1f4f

Please sign in to comment.