feat: add seed ratio display

This commit is contained in:
Simon Ding
2024-08-11 20:41:26 +08:00
parent 5c6ac2c430
commit 5b70badb50
4 changed files with 17 additions and 9 deletions

View File

@@ -15,7 +15,8 @@ import (
type Activity struct {
*ent.History
Progress int `json:"progress"`
Progress int `json:"progress"`
SeedRatio float32 `json:"seed_ratio"`
}
func (s *Server) GetAllActivities(c *gin.Context) (interface{}, error) {
@@ -35,6 +36,7 @@ func (s *Server) GetAllActivities(c *gin.Context) (interface{}, error) {
for id, task := range s.core.GetTasks() {
if h.ID == id && task.Exists() {
a.Progress = task.Progress()
a.SeedRatio = float32(*task.SeedRatio())
}
}
activities = append(activities, a)