Module: QTimetrap::ViewModels::MainViewModelEntryNoteHelpers

Included in:
MainViewModel
Defined in:
app/view_models/main_view_model_entry_note_helpers.rb

Overview

Entry note update behavior for MainViewModel.

Instance Method Summary collapse

Instance Method Details

#update_entry_note(entry_id, note) ⇒ Object



7
8
9
10
11
12
13
# File 'app/view_models/main_view_model_entry_note_helpers.rb', line 7

def update_entry_note(entry_id, note)
  normalized_id = entry_id.to_i
  return if normalized_id.zero?

  gateway.update_note(normalized_id, note.to_s)
  @entries = entries.map { |entry| updated_entry_with_note(entry, normalized_id, note.to_s) }
end