@@ -62,9 +62,6 @@ class Claim < ApplicationRecord
6262 transitions from : %i[ waiting working ignored deleted notified ] , to : :failed
6363 end
6464
65- event :skip do
66- transitions from : %i[ waiting working failed deleted notified ] , to : :ignored
67- end
6865 end
6966
7067 alias_attribute :created , :created_at
@@ -194,14 +191,7 @@ def process_data(options = {})
194191
195192 result = collect_data
196193
197- if result . body [ "skip" ]
198- return finish! if put_code . present?
199-
200- logger . info "[Skipped] #{ uid } – #{ doi } : #{ result . body [ 'reason' ] } "
201- update_column ( :error_messages , [ ] )
202-
203- skip
204- elsif result . body [ "errors" ]
194+ if result . body [ "errors" ]
205195 update_column ( :error_messages , format_error_message ( result . body [ "errors" ] ) )
206196
207197 logger . error "[Error] #{ uid } – #{ doi } : #{ format_error_message ( result . body [ "errors" ] ) . inspect } "
@@ -248,15 +238,15 @@ def collect_data(options = {})
248238 response . body [ "notification" ] = true
249239 return response
250240 else
251- return OpenStruct . new ( body : { "skip " => true , "reason " => "No user and/or ORCID token" } )
241+ return OpenStruct . new ( body : { "errors " => [ { "title " => "No user and/or ORCID token" } ] } )
252242 end
253243 end
254244
255245 # user has not given permission for auto-update
256- return OpenStruct . new ( body : { "skip " => true , "reason " => "No auto-update permission" } ) if source_id == "orcid_update" && user && !user . auto_update
246+ return OpenStruct . new ( body : { "errors " => [ { "title " => "No auto-update permission" } ] } ) if source_id == "orcid_update" && user && !user . auto_update
257247
258248 # user has too many claims already
259- return OpenStruct . new ( body : { "skip " => true , "reason " => "Too many claims. Only 10,000 claims allowed." } ) if user . claims . total_count > 10000
249+ return OpenStruct . new ( body : { "errors " => [ { "title " => "Too many claims. Only 10,000 claims allowed." } ] } ) if user . claims . total_count > 10000
260250
261251 # missing data raise errors
262252 return OpenStruct . new ( body : { "errors" => [ { "title" => "Missing data" } ] } ) if work . data . nil?
0 commit comments