Skip to content

Commit

Permalink
#104 | groupBy both "form_mapping_uuid" and "repeatable_question_grou…
Browse files Browse the repository at this point in the history
…p_concept_uuid"
  • Loading branch information
himeshr committed Jun 12, 2024
1 parent 794f389 commit 685b8c3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ private List<TableMetadata> getChecklistTables() {

private List<TableMetadata> getTableMetadataForForm(String sql) {
List<Map<String, Object>> maps = runInOrgContext(() -> jdbcTemplate.queryForList(sql), jdbcTemplate);
Map<Object, List<Map<String, Object>>> tableMaps = maps.stream().collect(Collectors.groupingBy(stringObjectMap -> stringObjectMap.get("form_mapping_uuid")));
Map<Object, List<Map<String, Object>>> tableMaps = maps.stream().collect(Collectors.groupingBy(stringObjectMap -> {
String formMappingUuid = stringObjectMap.get("form_mapping_uuid").toString();
Object rwgConceptUUID = stringObjectMap.get("repeatable_question_group_concept_uuid");
return rwgConceptUUID == null ? formMappingUuid : formMappingUuid + rwgConceptUUID;
}));
return tableMaps.values().stream().map(mapList -> new TableMetadataMapper().create(mapList)).collect(Collectors.toList());
}

Expand Down

2 comments on commit 685b8c3

@1t5j0y
Copy link
Contributor

@1t5j0y 1t5j0y commented on 685b8c3 Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:

  1. Inconsistent casing of uuid in formMappingUuid and rwgConceptUUID
  2. rwg should be rqg?

@himeshr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor:

  1. Inconsistent casing of uuid in formMappingUuid and rwgConceptUUID
  2. rwg should be rqg?

Abosrbed both comments

Please sign in to comment.