remove create_new functionality, when exercise exists on CH but is not editable
This commit is contained in:
@ -14,8 +14,13 @@ module ExerciseService
|
||||
req.body = {uuid: @uuid}.to_json
|
||||
end
|
||||
response_hash = JSON.parse(response.body, symbolize_names: true)
|
||||
message = if response_hash[:exercise_found]
|
||||
response_hash[:update_right] ? I18n.t('exercises.export_codeharbor.check.exercise_found') : I18n.t('exercises.export_codeharbor.check.exercise_found_no_right')
|
||||
else
|
||||
I18n.t('exercises.export_codeharbor.check.no_exercise')
|
||||
end
|
||||
|
||||
{error: false}.merge(response_hash.slice(:message, :exercise_found, :update_right))
|
||||
{error: false, message: message}.merge(response_hash.slice(:exercise_found, :update_right))
|
||||
rescue Faraday::Error, JSON::ParserError
|
||||
{error: true, message: I18n.t('exercises.export_codeharbor.error')}
|
||||
end
|
||||
|
Reference in New Issue
Block a user