Skip to content

Commit 49c4cc9

Browse files
KB-10186 | Learner Portal | If user has Primary details, in the Service history default data is not calculating for Profile page percentage. (#45) (#46)
1. If user has Professional details and the Service history data is not there then we need to add the profile completion percentage based on the professiona details Co-authored-by: tarentomaheshvakkund <139739142+tarentomaheshvakkund@users.noreply.github.com>
1 parent 31bf219 commit 49c4cc9

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/java/com/igot/cb/profile/service/ProfileServiceImpl.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,16 @@ protected double calculateProfileCompletionPercentage(Map<String, Object> profil
588588
boolean isFilled;
589589
try {
590590
if (isExtendedProfileField(field)) {
591-
isFilled = hasExtendedProfileData(userId, field, userToken);
591+
isFilled = hasExtendedProfileData(userId, field, userToken)
592+
|| (Constants.SERVICE_HISTORY.equalsIgnoreCase(field) &&
593+
Optional.ofNullable(profileData.get(Constants.PROFILE_DETAILS))
594+
.filter(Map.class::isInstance)
595+
.map(Map.class::cast)
596+
.map(details -> details.get(Constants.PROFESSIONAL_DETAILS))
597+
.filter(List.class::isInstance)
598+
.map(List.class::cast)
599+
.map(CollectionUtils::isNotEmpty)
600+
.orElse(false));
592601
} else {
593602
Object value = profileData.getOrDefault(field, nestedData.get(field));
594603
isFilled = value != null && !value.toString().trim().isEmpty();

src/main/java/com/igot/cb/util/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ public class Constants {
436436
public static final String COMPETENCY_THEME_GROUPS = "competencyThemeGroups";
437437
public static final String INDEX = "index";
438438
public static final String PROFILE_COMPLETION_PERCENTAGE = "profileCompletionPercentage";
439+
public static final String PROFESSIONAL_DETAILS = "professionalDetails";
439440

440441
private Constants() {
441442
}

0 commit comments

Comments
 (0)