mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-17 22:03:41 +00:00
fix: sort of completed tasks (#297)
This commit is contained in:
7 files changed
+25
-19
No files matched your search
@@ -24,6 +24,7 @@ type Task struct {
|
||||
Status base.Status `json:"status"`
|
||||
Progress *Progress `json:"progress"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
|
||||
fetcherBuilder fetcher.FetcherBuilder
|
||||
fetcher fetcher.Fetcher
|
||||
@@ -41,9 +42,15 @@ func NewTask() *Task {
|
||||
ID: id,
|
||||
Status: base.DownloadStatusReady,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Task) updateStatus(status base.Status) {
|
||||
t.UpdatedAt = time.Now()
|
||||
t.Status = status
|
||||
}
|
||||
|
||||
func (t *Task) clone() *Task {
|
||||
return &Task{
|
||||
ID: t.ID,
|
||||
@@ -51,6 +58,7 @@ func (t *Task) clone() *Task {
|
||||
Status: t.Status,
|
||||
Progress: t.Progress,
|
||||
CreatedAt: t.CreatedAt,
|
||||
UpdatedAt: t.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user