fix: preserve order dispatch mode
This commit is contained in:
@@ -341,7 +341,9 @@ func (s *Store) AutoMatchTaskOrder(ctx context.Context, tenantID, memberID, orde
|
||||
}
|
||||
}
|
||||
}
|
||||
if order.AutoDispatch != 1 || time.Now().UTC().Before(matchAt) {
|
||||
dispatchMode, _ := snapshot["dispatch_mode"].(string)
|
||||
isAutoDispatch := dispatchMode == "auto" || dispatchMode == "" && order.AutoDispatch == 1
|
||||
if !isAutoDispatch || time.Now().UTC().Before(matchAt) {
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ type Order struct {
|
||||
Status string `json:"status"`
|
||||
StatusText string `json:"status_text"`
|
||||
Message string `json:"message"`
|
||||
DispatchMode string `json:"dispatch_mode,omitempty"`
|
||||
ScheduledMatchAt string `json:"scheduled_match_at,omitempty"`
|
||||
DispatchDelay int `json:"dispatch_delay_seconds,omitempty"`
|
||||
DeadlineAt string `json:"deadline_at"`
|
||||
@@ -397,6 +398,7 @@ func orderFromStore(row store.TaskOrder, detail bool) Order {
|
||||
DeadlineAt: row.DeadlineAt, CreatedAt: row.CreatedAt, UpdatedAt: row.UpdatedAt}
|
||||
var snapshot map[string]any
|
||||
if json.Unmarshal(row.RuleSnapshot, &snapshot) == nil {
|
||||
result.DispatchMode, _ = snapshot["dispatch_mode"].(string)
|
||||
result.ScheduledMatchAt, _ = snapshot["scheduled_match_at"].(string)
|
||||
result.DispatchDelay = intValue(snapshot["dispatch_delay_seconds"])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user