From d88a3faf4fe49962b487f610f7990f541ce566e0 Mon Sep 17 00:00:00 2001
From: jano3 <jano@uafrica.com>
Date: Tue, 25 Jan 2022 16:11:05 +0200
Subject: [PATCH] Added type to address hash (if it is not unknown)

---
 address_utils/address_utils.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/address_utils/address_utils.go b/address_utils/address_utils.go
index bb58a46..e4ef6ce 100644
--- a/address_utils/address_utils.go
+++ b/address_utils/address_utils.go
@@ -9,12 +9,16 @@ import (
 )
 
 // MD5HashOfAddress m(E,L,L) - calculates and returns the MD5 hash of the entered address, lat and lng concatenated together. If lat and lng is blank, it is only the hash of the entered address
-func MD5HashOfAddress(enteredAddress string, lat *float64, lng *float64) string {
+func MD5HashOfAddress(enteredAddress string, lat *float64, lng *float64, addressType *string) string {
 	valueToHash := enteredAddress
 	if lat != nil && lng != nil {
 		valueToHash += fmt.Sprintf(",%v,%v", *lat, *lng)
 	}
 
+	if addressType != nil && len(*addressType) > 0 && *addressType != "unknown" {
+		valueToHash += fmt.Sprintf(",%s", *addressType)
+	}
+
 	return fmt.Sprintf("%X", md5.Sum([]byte(valueToHash)))
 }
 
-- 
GitLab