Class: Checkoff::Internal::SearchUrl::CustomFieldVariant::Is

Inherits:
CustomFieldVariant show all
Defined in:
lib/checkoff/internal/search_url/custom_field_variant.rb

Overview

custom_field_#CustomFieldVariant#gid.variant = ‘is’

Instance Method Summary collapse

Methods inherited from CustomFieldVariant

#initialize

Constructor Details

This class inherits a constructor from Checkoff::Internal::SearchUrl::CustomFieldVariant::CustomFieldVariant

Instance Method Details

#convertArray<(Hash, Array)>

Returns:

  • (Array<(Hash, Array)>)


180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/checkoff/internal/search_url/custom_field_variant.rb', line 180

def convert
  selected_options = fetch_solo_param("custom_field_#{gid}.selected_options").split('~')

  empty_task_selector = []
  if selected_options.length == 1
    [{ "custom_fields.#{gid}.value" => selected_options[0] },
     empty_task_selector]
  else
    # As of 2023-01,
    # https://developers.asana.com/reference/searchtasksforworkspace
    # says "Not Supported: searching for multiple exact
    # matches of a custom field".  So I guess we have to
    # search this manually.
    api_params = { "custom_fields.#{gid}.is_set" => 'true' }
    task_selector = [:custom_field_gid_value_contains_any_gid?, gid, selected_options]
    [api_params, task_selector]
  end
end