Skip to content

Commit

Permalink
fix country update trigger on user modification
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-cronus committed Jun 10, 2024
1 parent 84728ed commit b169e84
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions users/top_countries.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func (r *repository) updateTotalUsersPerCountryCount(ctx context.Context, usr *U
return errors.Wrap(ctx.Err(), "context failed")
}
}
countryChanged := usr.User != nil && usr.User.ID != "" && usr.Before != nil && usr.Before.ID != "" && usr.User.Country != usr.Before.Country
if !countryChanged {
return nil
}
nextIndex := 1
values := make([]string, 0, 1+1)
params := make([]any, 0, 1+1)
Expand Down

0 comments on commit b169e84

Please sign in to comment.