getListOfHighlightedDeputes method

List<DeputesFromCsv> getListOfHighlightedDeputes(
  1. List<DeputesFromCsv> allDeputes,
  2. GroupVotesFromJson groupInScrutin
)

used by drawVoteHemicycleFromPath FutureBuilder returns a List of DeputesFromCsv from a scrutin.GroupVotesFromJson and the list of All Deputies to provide.

Implementation

List<DeputesFromCsv> getListOfHighlightedDeputes(
    List<DeputesFromCsv> allDeputes, GroupVotesFromJson groupInScrutin) {
  List<DeputesFromCsv> _toReturn = [];
  if ((groupInScrutin.deputesRefToHilite ?? []).length > 0) {
    for (IndividualVoteFromJson voter in groupInScrutin.deputesRefToHilite!) {
      // print("** " + (voter.acteurRef ?? "-") + " **");
      for (DeputesFromCsv depute in allDeputes) {
        if (depute.deputeRef == (voter.acteurRef ?? "")) {
          _toReturn.add(DeputesFromCsv.fromVote(depute, voter));
        }
      }
    }
  }
  return _toReturn;
}