Refine arrival filters and demo date behavior
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type StationBadge struct {
|
||||
@@ -141,7 +142,10 @@ func GetStationProgress(mcuID int, date string) (map[int][]StationBadge, error)
|
||||
sp.Mcu_StationProgressPreregisterID,
|
||||
sp.Mcu_StationProgressStationName,
|
||||
CASE
|
||||
WHEN sp.Mcu_StationProgressDoneAt IS NOT NULL THEN 'success'
|
||||
WHEN sp.Mcu_StationProgressSource = 'lab'
|
||||
AND sp.Mcu_StationProgressReceiveAt IS NOT NULL THEN 'success'
|
||||
WHEN sp.Mcu_StationProgressSource = 'nonlab'
|
||||
AND sp.Mcu_StationProgressDoneAt IS NOT NULL THEN 'success'
|
||||
WHEN sp.Mcu_StationProgressProcessAt IS NOT NULL
|
||||
OR sp.Mcu_StationProgressReceiveAt IS NOT NULL
|
||||
OR sp.Mcu_StationProgressSamplingAt IS NOT NULL THEN 'warning'
|
||||
@@ -293,6 +297,12 @@ func activeDateOrLatest(dates []string, selected string, fallback string) string
|
||||
}
|
||||
}
|
||||
}
|
||||
today := time.Now().Format("2006-01-02")
|
||||
for _, d := range dates {
|
||||
if d == today {
|
||||
return today
|
||||
}
|
||||
}
|
||||
if len(dates) > 0 {
|
||||
return dates[0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user