@@ -67,14 +67,19 @@ status <- function(status, date = Sys.Date(), comments = "") {
6767 if (tolower(status ) == tolower(guess )) {
6868 status <- guess
6969 } else {
70- stop(status , " is not a known status. " ,
71- " Did you mean " , amatch_status(status ), " ?" ,
70+ stop(
71+ status ,
72+ " is not a known status. " ,
73+ " Did you mean " ,
74+ amatch_status(status ),
75+ " ?" ,
7276 call. = FALSE
7377 )
7478 }
7579 }
7680
77- structure(list (date = date , status = status , comments = comments ),
81+ structure(
82+ list (date = date , status = status , comments = comments ),
7883 class = " status"
7984 )
8085}
@@ -100,7 +105,10 @@ c.status <- c.status_list <- function(..., recursive = FALSE) {
100105
101106# ' @export
102107format.status <- function (x , ... ) {
103- paste(format(x $ date ), " " , x $ status ,
108+ paste(
109+ format(x $ date ),
110+ " " ,
111+ x $ status ,
104112 if (! empty(x $ comments )) paste(" [" , x $ comments , " ]" , sep = " " ),
105113 sep = " "
106114 )
@@ -110,8 +118,11 @@ print.status <- function(x, ...) cat(format(x), "\n")
110118
111119# ' @importFrom utils adist
112120amatch_status <- function (status ) {
113- ldist <- adist(status , valid_status ,
114- ignore.case = TRUE , partial = FALSE ,
121+ ldist <- adist(
122+ status ,
123+ valid_status ,
124+ ignore.case = TRUE ,
125+ partial = FALSE ,
115126 costs = c(ins = 0.5 , sub = 1 , del = 2 )
116127 )[1 , ]
117128 valid_status [which.min(ldist )]
@@ -132,29 +143,37 @@ todo <- function(x) {
132143
133144 status <- last_status(x )$ status
134145 status_date <- last_status(x )$ date
135- if (status == " resubmission" ) {
136- # Sent back to author to fix before allocating an editor
146+ if (
147+ status %in%
148+ c(
149+ " resubmission" ,
150+ " reject and resubmit" ,
151+ " major revision" ,
152+ " minor revision" ,
153+ " accepted" ,
154+ " copy edited"
155+ )
156+ ) {
137157 " waiting (author)"
138- } else if (empty(x $ editor ) |
139- status == " submitted" |
140- (status == " revision received" & status_date > " 2025-01-01" )
141- ) {
158+ } else if (
159+ empty(x $ editor ) |
160+ status == " submitted" |
161+ (status == " revision received" & status_date > " 2025-01-01" )
162+ ) {
142163 # Needs an editor, or needs an acknowledgement.
143164 # Ignore unacknowledged revisions before 2025
144165 " waiting (editor-in-chief)"
145- } else if (status == " with AE" ) {
166+ } else if (status == " with AE" ) {
146167 " waiting (AE)"
147168 } else if (empty(x $ reviewers )) {
148169 " waiting (editor)"
149- } else if (status == " out for review" & completed_reviews(x ) > = 2 ) {
150- " waiting (editor)"
170+ } else if (status == " out for review" & completed_reviews(x ) > = 2 ) {
171+ " waiting (editor)"
151172 } else {
152- switch (status ,
153- " major revision" = " waiting (author)" ,
154- " minor revision" = " waiting (author)" ,
173+ switch (
174+ status ,
155175 " out for review" = " waiting (reviewers)" ,
156176 " updated" = " waiting (editor)" ,
157- " reject and resubmit" = " waiting (author)" ,
158177 " published" = " needs removal (editor)" ,
159178 " withdrawn" = " needs removal (editor)" ,
160179 " rejected" = " needs removal (editor)" ,
@@ -163,10 +182,8 @@ todo <- function(x) {
163182 " AE: minor revision" = " waiting (editor)" ,
164183 " AE: accept" = " waiting (editor)" ,
165184 " AE: reject" = " waiting (editor)" ,
166- " accepted" = " waiting (author)" ,
167185 " style checked" = " needs online (editor-in-chief)" ,
168186 " online" = " needs copy-editing (editor)" ,
169- " copy edited" = " waiting (author)" ,
170187 " proofed" = " ready for publication (editor-in-chief)" ,
171188 " acknowledged" = " needs reviewers (editor)" ,
172189 stop(" Unknown status: " , status )
@@ -239,7 +256,8 @@ parse_status <- function(x) {
239256 if (! stringr :: str_detect(x , re )) {
240257 # NM added line
241258 cat(" bad status:" , x , " \n " )
242- stop(" Status must have form 'yyyy-mm-dd status [optional comments]'" ,
259+ stop(
260+ " Status must have form 'yyyy-mm-dd status [optional comments]'" ,
243261 call. = FALSE
244262 )
245263 }
0 commit comments