fix(alert): alert only once
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8fa7736b88
commit
d3be6ca49c
@ -66,22 +66,26 @@ func checkPrice(alertChan chan api.Availability) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StdAlert := false
|
||||||
|
LrAlert := false
|
||||||
for _, availability := range availabilities.Results {
|
for _, availability := range availabilities.Results {
|
||||||
|
|
||||||
if availability.IsDemo {
|
if availability.IsDemo {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if availability.Price < 39000 && availability.Trim[0] == "SRRWD" {
|
if !StdAlert && availability.Price < 39000 && availability.Trim[0] == "SRRWD" {
|
||||||
log.Info("Launching an alert !")
|
log.Info("Launching an alert !")
|
||||||
alertChan <- availability
|
alertChan <- availability
|
||||||
alert++
|
alert++
|
||||||
|
StdAlert = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if availability.Price < 47000 && availability.Trim[0] == "LRAWD" {
|
if !LrAlert && availability.Price < 47000 && availability.Trim[0] == "LRAWD" {
|
||||||
log.Info("Launching an alert !")
|
log.Info("Launching an alert !")
|
||||||
alertChan <- availability
|
alertChan <- availability
|
||||||
alert++
|
alert++
|
||||||
|
LrAlert = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user