Ajout d'un champ de rapport basique pour décrire la prise de décision
- Enregistrement et prise en compte dans l'affichage des évènements de vote/clotûre d'un DAD
This commit is contained in:
@ -3,6 +3,7 @@ package model
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
errs "github.com/pkg/errors"
|
||||
@ -75,6 +76,14 @@ func (r *DSFRepository) updateFromChanges(dsf *DecisionSupportFile, changes *Dec
|
||||
}
|
||||
|
||||
if changes.Status != nil {
|
||||
if dsf.Status != StatusVoted && *changes.Status == StatusVoted {
|
||||
dsf.VotedAt = time.Now().UTC()
|
||||
}
|
||||
|
||||
if *changes.Status == StatusClosed {
|
||||
dsf.VotedAt = time.Time{}
|
||||
}
|
||||
|
||||
dsf.Status = *changes.Status
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,10 @@ func (v *DecisionSupportFileVoter) Vote(ctx context.Context, subject interface{}
|
||||
case ActionRead:
|
||||
return voter.Allow, nil
|
||||
case ActionUpdate:
|
||||
if dsf.Status == StatusClosed || dsf.Status == StatusVoted {
|
||||
return voter.Deny, nil
|
||||
}
|
||||
|
||||
if inWorkgroup(user, dsf.Workgroup) {
|
||||
return voter.Allow, nil
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ const (
|
||||
EventTypeClosed EventType = "closed"
|
||||
EventTypeStatusChanged EventType = "status-changed"
|
||||
EventTypeTitleChanged EventType = "title-changed"
|
||||
EventTypeVoted EventType = "voted"
|
||||
)
|
||||
|
||||
type EventObject interface {
|
||||
|
Reference in New Issue
Block a user