Skip to content

Commit

Permalink
fix: correct hado description, amount format (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmquang authored Nov 27, 2023
1 parent cb2ba01 commit aa6f937
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ require (
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/jackc/numfmt v0.0.0-20210209201056-0429016d44dd // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/numfmt v0.0.0-20210209201056-0429016d44dd h1:Zg6UrrbEJb8wEi6rLpQTlpu6Qb8cP/ytD/pTnBpZuTw=
github.com/jackc/numfmt v0.0.0-20210209201056-0429016d44dd/go.mod h1:FzqnI8NpERpMvRZySq/ejY2JzvImBjshjCkB5Bk9fIQ=
github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
Expand Down
11 changes: 8 additions & 3 deletions pkg/handler/accounting/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/gin-gonic/gin"
"github.com/jackc/numfmt"

"github.com/dwarvesf/fortress-api/pkg/config"
"github.com/dwarvesf/fortress-api/pkg/logger"
Expand All @@ -16,7 +17,6 @@ import (
bcModel "github.com/dwarvesf/fortress-api/pkg/service/basecamp/model"
"github.com/dwarvesf/fortress-api/pkg/store"
"github.com/dwarvesf/fortress-api/pkg/store/project"
"github.com/dwarvesf/fortress-api/pkg/utils"
"github.com/dwarvesf/fortress-api/pkg/utils/timeutil"
"github.com/dwarvesf/fortress-api/pkg/view"
)
Expand Down Expand Up @@ -127,7 +127,7 @@ func (h handler) createTodoInOutGroup(outGroupID int, projectID int, outTodoTemp

// Create CBRE management fee from `Office Rental` template
if strings.Contains(v.Name, "Office Rental") {
partment := strings.Replace(v.Name, "Office Rental ", "", 1)
partment := strings.Replace(v.Name, "Office Rental", "", 1)
extraMsg = fmt.Sprintf("Hado Office Rental %s %v/%v", partment, month, year)

s := v.Name
Expand All @@ -144,8 +144,13 @@ func (h handler) createTodoInOutGroup(outGroupID int, projectID int, outTodoTemp
}
}

f := &numfmt.Formatter{
NegativeTemplate: "(n)",
MinDecimalPlaces: 0,
}

todo := bcModel.Todo{
Content: fmt.Sprintf("%s | %s | %s", v.Name, utils.FormatCurrencyAmount(v.Amount), v.Currency.Name), //nolint:govet
Content: fmt.Sprintf("%s | %s | %s", v.Name, strings.Replace(f.Format(v.Amount), ",", ".", -1), v.Currency.Name), //nolint:govet
DueOn: fmt.Sprintf("%v-%v-%v", timeutil.LastDayOfMonth(month, year).Day(), month, year),
AssigneeIDs: []int{consts.QuangBasecampID},
Description: extraMsg,
Expand Down

0 comments on commit aa6f937

Please sign in to comment.