getCollectiveInstrumentMatches static method

List<Instrument> getCollectiveInstrumentMatches(
  1. Collective collective,
  2. Map<String, Instrument> profileInstruments
)

Implementation

static List<Instrument> getCollectiveInstrumentMatches(Collective collective, Map<String,Instrument> profileInstruments) {

  List<Instrument> collectiveInstrumentMatches = [];

  try {
    for (var collectiveMember in collective.members!.values) {
      if(profileInstruments.containsKey(collectiveMember.instrument!.id)
          && collectiveMember.profileId.isEmpty) {
        collectiveInstrumentMatches.add(profileInstruments[collectiveMember.instrument!.id] ?? Instrument());
      }
    }
  } catch (e, st) {
    NeomErrorLogger.recordError(e, st, module: 'neom_core', operation: 'getCollectiveInstrumentMatches');
  }

  return collectiveInstrumentMatches;
}