mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-08 09:30:27 +00:00
Merge PR #1536 into 2.0.0-beta.2
# Conflicts: # ui/flutter/test/widget_test.dart
This commit is contained in:
commit
a5ebbca318
30 files changed
+112
-22
No files matched your search
@@ -32,6 +32,10 @@ type Task struct {
|
||||
Progress *Progress `json:"progress"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
// DoneAt is the time when the task completed; nil if it has never
|
||||
// finished. A done task never leaves the done state, so the value is
|
||||
// written once and kept.
|
||||
DoneAt *time.Time `json:"doneAt"`
|
||||
|
||||
producer production.Source
|
||||
producerReceived int64
|
||||
@@ -134,6 +138,12 @@ func (t *Task) MarshalJSON() ([]byte, error) {
|
||||
func (t *Task) updateStatus(status base.Status) {
|
||||
t.UpdatedAt = time.Now()
|
||||
t.Status = status
|
||||
// A done task never leaves the done state, so there is no branch to clear
|
||||
// DoneAt on other transitions.
|
||||
if status == base.DownloadStatusDone {
|
||||
doneAt := time.Now()
|
||||
t.DoneAt = &doneAt
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Task) clone() *Task {
|
||||
|
||||
Reference in new issue
Block a user