Skip to content

Commit

Permalink
feat(task): add submitted status to tasks with submission
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Jan 10, 2023
1 parent f60bc68 commit edd0e2b
Show file tree
Hide file tree
Showing 5 changed files with 664 additions and 212 deletions.
8 changes: 8 additions & 0 deletions app/nemeton/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
type TaskState struct {
Completed bool `bson:"completed"`
EarnedPoints uint64 `bson:"points"`
Submitted bool `bson:"submitted"`
}

type Task struct {
Expand Down Expand Up @@ -55,6 +56,13 @@ func (t Task) InProgressAt(at time.Time) bool {
return t.StartedAt(at) && !t.FinishedAt(at)
}

func (t Task) WithSubmission() bool {
return t.Type == taskTypeSubmission ||
t.Type == TaskTypeRPC ||
t.Type == TaskTypeSnapshots ||
t.Type == TaskTypeDashboard
}

func (t Task) GetParamMaxPoints() *uint64 {
if v, ok := t.Params[taskParamMaxPoints]; ok {
if maxPoints, ok := v.(int64); ok {
Expand Down
Loading

0 comments on commit edd0e2b

Please sign in to comment.