Skip to content

Commit

Permalink
avniproject/avni-product#1646 | Restore changes for #749 after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Aug 20, 2024
1 parent 8f86adf commit 0350404
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,9 @@ private void createGender(String genderName, Organisation org) {
}

private Group addDefaultGroupIfNotPresent(Long organisationId, String groupType) {
if (Objects.nonNull(groupRepository.findByNameAndOrganisationId(groupType, organisationId))) {
return null;
Group existingGroup = groupRepository.findByNameAndOrganisationId(groupType, organisationId);
if (Objects.nonNull(existingGroup)) {
return existingGroup;
}
Group group = new Group();
group.setName(groupType);
Expand All @@ -964,8 +965,10 @@ public void setupBaseOrganisationAdminConfig(Organisation organisation) {

public void setupBaseOrganisationMetadata(Organisation organisation) {
createDefaultGenders(organisation);
addDefaultGroupIfNotPresent(organisation.getId(), Group.Everyone);
Group everyoneGroup = addDefaultGroupIfNotPresent(organisation.getId(), Group.Everyone);
addDefaultGroupIfNotPresent(organisation.getId(), Group.Administrators);
Dashboard defaultDashboard = dashboardService.createDefaultDashboard(organisation);
groupDashboardService.createDefaultGroupDashboardForOrg(organisation, everyoneGroup, defaultDashboard);
}

public Organisation getCurrentOrganisation() {
Expand Down

0 comments on commit 0350404

Please sign in to comment.