Ajout des dossiers votés dans la newsletter

This commit is contained in:
wpetit 2020-10-12 13:11:57 +02:00
parent 1eaaa9065f
commit e5152aa652
2 changed files with 17 additions and 0 deletions

View File

@ -172,6 +172,16 @@ func NewDefault() *Config {
{{ end }}
{{- end}}
{{- with .Voted }}
Récemment votés
---------------
{{range . -}}
- "{{ .Title }}" - {{ $root.BaseURL }}/decisions/{{ .ID }} - voté le {{ .VotedAt.Format "02/01/2006" }}
{{ end }}
{{- end}}
{{- with .NewDecisionSupportFiles }}
Nouveaux dossiers d'aide à la décision

View File

@ -73,6 +73,7 @@ func (t *Newsletter) Run() {
newWorkgroups := make([]*model.Workgroup, 0)
newDecisionSupportFiles := make([]*model.DecisionSupportFile, 0)
readyToVote := make([]*model.DecisionSupportFile, 0)
voted := make([]*model.DecisionSupportFile, 0)
workgroupRepo := model.NewWorkgroupRepository(db)
dsfRepo := model.NewDSFRepository(db)
@ -122,6 +123,10 @@ func (t *Newsletter) Run() {
if dsf.Status == model.StatusReady {
readyToVote = append(readyToVote, dsf)
}
if dsf.Status == model.StatusVoted {
voted = append(voted, dsf)
}
}
}
@ -147,6 +152,7 @@ func (t *Newsletter) Run() {
NewWorkgroups []*model.Workgroup
NewDecisionSupportFiles []*model.DecisionSupportFile
ReadyToVote []*model.DecisionSupportFile
Voted []*model.DecisionSupportFile
BaseURL string
From time.Time
To time.Time
@ -157,6 +163,7 @@ func (t *Newsletter) Run() {
NewWorkgroups: newWorkgroups,
NewDecisionSupportFiles: newDecisionSupportFiles,
ReadyToVote: readyToVote,
Voted: voted,
From: from.Local(),
To: to.Local(),
HasEvents: hasEvents,