chore: fix
This commit is contained in:
@@ -345,18 +345,28 @@ func UpdateDeliveryStatus(c *gin.Context) {
|
||||
var clientMsg string
|
||||
switch req.Status {
|
||||
case "en_route":
|
||||
if etaMinutes > 0 {
|
||||
notifETA := etaMinutes
|
||||
if notifETA == 0 {
|
||||
if etaData, err := database.GetCommandETA(commandID); err == nil {
|
||||
if v, ok := etaData["total_eta_minutes"]; ok {
|
||||
if n, err2 := strconv.Atoi(v); err2 == nil && n > 0 {
|
||||
notifETA = n
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if notifETA > 0 {
|
||||
var etaStr string
|
||||
if etaMinutes >= 60 {
|
||||
h := etaMinutes / 60
|
||||
m := etaMinutes % 60
|
||||
if notifETA >= 60 {
|
||||
h := notifETA / 60
|
||||
m := notifETA % 60
|
||||
if m > 0 {
|
||||
etaStr = fmt.Sprintf("%dh%02d", h, m)
|
||||
} else {
|
||||
etaStr = fmt.Sprintf("%dh", h)
|
||||
}
|
||||
} else {
|
||||
etaStr = fmt.Sprintf("%d min", etaMinutes)
|
||||
etaStr = fmt.Sprintf("%d min", notifETA)
|
||||
}
|
||||
clientMsg = fmt.Sprintf("Un livreur vient de prendre en charge ta commande #%d, il est en route (~%s)", database.GetClientOrderID(commandID), etaStr)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user