Compare commits

..

No commits in common. "90367fe53ec8f8ec60e3b064267878edc5ef137e" and "813b92af78a3e216e53dec48cc0c3e3e95bcc446" have entirely different histories.

4 changed files with 10 additions and 11 deletions

View File

@ -2015,18 +2015,17 @@ func (h *Handlers) insertProfileItems(ctx context.Context, sessionId string, res
for index, profileItem := range h.profile.ProfileItems { for index, profileItem := range h.profile.ProfileItems {
// Ensure the profileItem is not "0"(is set) // Ensure the profileItem is not "0"(is set)
if profileItem != "0" { if profileItem != "0" {
flag, _ := h.flagManager.GetFlag(profileFlagNames[index])
isProfileItemSet := h.st.MatchFlag(flag, true)
if !isProfileItemSet {
err = store.WriteEntry(ctx, sessionId, profileDataKeys[index], []byte(profileItem)) err = store.WriteEntry(ctx, sessionId, profileDataKeys[index], []byte(profileItem))
if err != nil { if err != nil {
logg.ErrorCtxf(ctx, "failed to write profile entry with", "key", profileDataKeys[index], "value", profileItem, "error", err) logg.ErrorCtxf(ctx, "failed to write profile entry with", "key", profileDataKeys[index], "value", profileItem, "error", err)
return err return err
} }
// Get the flag for the current index
flag, _ := h.flagManager.GetFlag(profileFlagNames[index])
res.FlagSet = append(res.FlagSet, flag) res.FlagSet = append(res.FlagSet, flag)
} }
} }
}
return nil return nil
} }

View File

@ -430,7 +430,7 @@
}, },
{ {
"input": "1234", "input": "1234",
"expectedContent": "My profile:\nName: foo bar\nGender: male\nAge: 79\nLocation: Kilifi\nYou provide: Bananas\n\n0:Back" "expectedContent": "My profile:\nName: foo bar\nGender: male\nAge: 84\nLocation: Kilifi\nYou provide: Bananas\n\n0:Back"
}, },
{ {
"input": "0", "input": "0",

View File

@ -10,4 +10,5 @@ CATCH _ flag_back_set 1
RELOAD save_offerings RELOAD save_offerings
INCMP _ 0 INCMP _ 0
CATCH pin_entry flag_offerings_set 1 CATCH pin_entry flag_offerings_set 1
CATCH pin_entry flag_offerings_set 0
INCMP update_profile_items * INCMP update_profile_items *

View File

@ -11,4 +11,3 @@ INCMP _ 0
INCMP set_male 1 INCMP set_male 1
INCMP set_female 2 INCMP set_female 2
INCMP set_unspecified 3 INCMP set_unspecified 3
INCMP . *