Merge pull request 'profile-update-fix' (#226) from profile-update-fix into master
Reviewed-on: #226 Reviewed-by: lash <accounts-grassrootseconomics@holbrook.no>
This commit is contained in:
		
						commit
						90367fe53e
					
				| @ -2015,15 +2015,16 @@ func (h *Handlers) insertProfileItems(ctx context.Context, sessionId string, res | ||||
| 	for index, profileItem := range h.profile.ProfileItems { | ||||
| 		// Ensure the profileItem is not "0"(is set)
 | ||||
| 		if profileItem != "0" { | ||||
| 			err = store.WriteEntry(ctx, sessionId, profileDataKeys[index], []byte(profileItem)) | ||||
| 			if err != nil { | ||||
| 				logg.ErrorCtxf(ctx, "failed to write profile entry with", "key", profileDataKeys[index], "value", profileItem, "error", err) | ||||
| 				return err | ||||
| 			} | ||||
| 
 | ||||
| 			// Get the flag for the current index
 | ||||
| 			flag, _ := h.flagManager.GetFlag(profileFlagNames[index]) | ||||
| 			res.FlagSet = append(res.FlagSet, flag) | ||||
| 			isProfileItemSet := h.st.MatchFlag(flag, true) | ||||
| 			if !isProfileItemSet { | ||||
| 				err = store.WriteEntry(ctx, sessionId, profileDataKeys[index], []byte(profileItem)) | ||||
| 				if err != nil { | ||||
| 					logg.ErrorCtxf(ctx, "failed to write profile entry with", "key", profileDataKeys[index], "value", profileItem, "error", err) | ||||
| 					return err | ||||
| 				} | ||||
| 				res.FlagSet = append(res.FlagSet, flag) | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	return nil | ||||
|  | ||||
| @ -430,7 +430,7 @@ | ||||
|                 }, | ||||
|                 { | ||||
|                     "input": "1234", | ||||
|                     "expectedContent": "My profile:\nName: foo bar\nGender: male\nAge: 84\nLocation: Kilifi\nYou provide: Bananas\n\n0:Back" | ||||
|                     "expectedContent": "My profile:\nName: foo bar\nGender: male\nAge: 79\nLocation: Kilifi\nYou provide: Bananas\n\n0:Back" | ||||
|                 }, | ||||
|                 { | ||||
|                     "input": "0", | ||||
|  | ||||
| @ -10,5 +10,4 @@ CATCH _ flag_back_set 1 | ||||
| RELOAD save_offerings | ||||
| INCMP _ 0 | ||||
| CATCH pin_entry flag_offerings_set 1 | ||||
| CATCH pin_entry flag_offerings_set 0 | ||||
| INCMP update_profile_items * | ||||
|  | ||||
| @ -11,3 +11,4 @@ INCMP _ 0 | ||||
| INCMP set_male 1 | ||||
| INCMP set_female 2 | ||||
| INCMP set_unspecified 3 | ||||
| INCMP . * | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user