fix statusTag being non-nil on active projects.
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-02-27 19:23:24 +01:00
parent 16237a89a4
commit e7be563407
4 changed files with 18 additions and 1 deletions
+4
View File
@@ -54,6 +54,10 @@ func Project(g *gin.RouterGroup, db database.Database) {
return nil, err return nil, err
} }
if project.Active && project.StatusTag != nil {
project.StatusTag = nil
}
return &models.ProjectResult{ return &models.ProjectResult{
Project: project, Project: project,
Tasks: []*models.TaskResult{}, Tasks: []*models.TaskResult{},
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
UPDATE project SET status_tag=NULL WHERE active=true;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
SELECT 'Nothing to do';
-- +goose StatementEnd
+4
View File
@@ -47,6 +47,10 @@ func (project *Project) Update(update ProjectUpdate) {
if update.Favorite != nil { if update.Favorite != nil {
project.Favorite = *update.Favorite project.Favorite = *update.Favorite
} }
if project.StatusTag != nil && !project.Active {
project.StatusTag = nil
}
} }
type ProjectUpdate struct { type ProjectUpdate struct {
+1 -1
View File
@@ -53,7 +53,7 @@
stuffLogClient.createProject({ stuffLogClient.createProject({
active: statusTag === "", active: statusTag === "",
endTime: ( endTime == "" ) ? null : new Date(endTime), endTime: ( endTime == "" ) ? null : new Date(endTime),
statusTag: statusTag || null, statusTag: statusTag !== "" ? statusTag : null,
name, description, icon, favorite, name, description, icon, favorite,
}).then(() => { }).then(() => {