getInstrumentMatches static method

Map<String, Instrument> getInstrumentMatches(
  1. Event event,
  2. Map<String, Instrument> profileInstruments
)

Implementation

static Map<String, Instrument> getInstrumentMatches(Event event, Map<String,Instrument> profileInstruments) {
  Map<String, Instrument> matchedInstruments = <String, Instrument>{};

  try {
    for (var instrumentFulfillment in event.instrumentsFulfillment ?? []) {
      if(profileInstruments.containsKey(instrumentFulfillment.instrument.id)
          && !instrumentFulfillment.isFulfilled) {
        matchedInstruments[instrumentFulfillment.instrument.id] = instrumentFulfillment.instrument;
      }
    }
  } catch (e) {
    AppConfig.logger.e(e.toString());
  }

  return matchedInstruments;
}