Method: OpenC3::ScriptStatusModel#update

Defined in:
lib/openc3/models/script_status_model.rb

#update(force: false, queued: false) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/openc3/models/script_status_model.rb', line 192

def update(force: false, queued: false)
  # Magically handle the change from running to completed
  if is_complete?() and @primary_key == "#{RUNNING_PRIMARY_KEY}__#{@scope}"
    # Destroy the running key
    destroy()
    @destroyed = false

    # Move to completed
    @primary_key = "#{COMPLETED_PRIMARY_KEY}__#{@scope}"
    create(update: false, force: force, queued: queued, isoformat: true)
  else
    create(update: true, force: force, queued: queued, isoformat: true)
  end
end