minor-bug-fixes #177

Merged
lash merged 26 commits from minor-bug-fixes into master 2024-12-03 18:18:23 +01:00
2 changed files with 18 additions and 12 deletions
Showing only changes of commit ba430a5849 - Show all commits

View File

@ -1398,18 +1398,7 @@ func (h *Handlers) GetProfileInfo(ctx context.Context, sym string, input []byte)
offerings := getEntryOrDefault(store.ReadEntry(ctx, sessionId, common.DATA_OFFERINGS))
// Construct the full name
name := defaultValue
if familyName != defaultValue {
if firstName != defaultValue {
name = firstName + " " + familyName
} else {
name = familyName
}
} else {
if firstName != defaultValue {
name = firstName
}
}
name := utils.ConstructName(firstName, familyName, defaultValue)
// Calculate age from year of birth
Alfred-mk marked this conversation as resolved Outdated
Outdated
Review

Probably nicer in a separate function "constructName"?

Probably nicer in a separate function "constructName"?

This has been added in ..utils/name.go

This has been added in ..utils/name.go
age := defaultValue

17
internal/utils/name.go Normal file
View File

@ -0,0 +1,17 @@
package utils
func ConstructName(firstName, familyName, defaultValue string) string {
name := defaultValue
if familyName != defaultValue {
if firstName != defaultValue {
name = firstName + " " + familyName
} else {
name = familyName
}
} else {
if firstName != defaultValue {
name = firstName
}
}
return name
}