Skip to content

Commit

Permalink
Add mock data when debug switch is on and empty result
Browse files Browse the repository at this point in the history
  • Loading branch information
websterzh committed May 21, 2023
1 parent 785f64c commit 2b1565b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gin/services/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
goredis "github.com/redis/go-redis/v9"
"log"
"math"
"vatprc-queue/config"
"vatprc-queue/redis"
)

Expand Down Expand Up @@ -47,6 +48,12 @@ func GetQueueResult(airport string, withExtra bool) []QueueResult {
Extra: extra,
}
}

if config.File.Section("app").Key("debug").MustBool(false) && len(result) == 0 {
result = append(result, QueueResult{Status: 1, Callsign: "DEBUG1", Extra: &QueueExtra{Cid: "1", Departure: "TEST", Arrival: "TEST"}})
result = append(result, QueueResult{Status: 1, Callsign: "DEBUG2", Extra: &QueueExtra{Cid: "2", Departure: "TEST", Arrival: "TEST"}})
result = append(result, QueueResult{Status: 1, Callsign: "DEBUG3", Extra: &QueueExtra{Cid: "3", Departure: "TEST", Arrival: "TEST"}})
}
return result
}

Expand Down

0 comments on commit 2b1565b

Please sign in to comment.