getCollectiveMemberInstrumentMatches static method

Map<String, Instrument> getCollectiveMemberInstrumentMatches(
  1. List<CollectiveMember> collectiveMembers,
  2. Map<String, Instrument> profileInstruments
)

Implementation

static Map<String, Instrument> getCollectiveMemberInstrumentMatches(List<CollectiveMember> collectiveMembers, Map<String,Instrument> profileInstruments) {

  Map<String, Instrument> collectiveInstrumentMatches = {};

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

  return collectiveInstrumentMatches;
}