Skip to content

Commit

Permalink
fix: profile view
Browse files Browse the repository at this point in the history
  • Loading branch information
namnhce committed Oct 9, 2023
1 parent 75451d7 commit c5cb35f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ require (
github.com/bwmarrin/discordgo v0.26.1
github.com/gin-gonic/gin v1.8.2
github.com/joho/godotenv v1.4.0
github.com/k0kubun/pp/v3 v3.2.0
github.com/sashabaranov/go-openai v1.10.1
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.14.0
gopkg.in/yaml.v2 v2.4.0
)

require (
Expand All @@ -26,6 +28,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -44,6 +47,5 @@ require (
golang.org/x/text v0.7.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/k0kubun/pp/v3 v3.2.0 h1:h33hNTZ9nVFNP3u2Fsgz8JXiF5JINoZfFq4SvKJwNcs=
github.com/k0kubun/pp/v3 v3.2.0/go.mod h1:ODtJQbQcIRfAD3N+theGCV1m/CBxweERz2dapdz1EwA=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand All @@ -168,6 +170,8 @@ github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
Expand Down
7 changes: 3 additions & 4 deletions pkg/discord/view/profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ func (v *Profile) List(original *model.DiscordMessage, employees []model.Employe
userInfo := ""
userInfo += fmt.Sprintf("%v `Full Name. `**%v**\n", gender, employee.FullName)
userInfo += fmt.Sprintf(":birthday: `DoB. `%v\n", employee.Birthday.Format("2006 Jan 02"))

mmaScores := fmt.Sprintf("%v `Mastery. `%v\n", constant.GetEmoji("BADGE1"), employee.MmaScore.MasteryScore)
mmaScores += fmt.Sprintf("%v `Meaning. `%v\n", constant.GetEmoji("BADGE2"), employee.MmaScore.MeaningScore)
mmaScores += fmt.Sprintf("%v `Autonomy. `%v\n", constant.GetEmoji("BADGE3"), employee.MmaScore.AutonomyScore)
mmaScores := fmt.Sprintf("%v `Mastery. `%v\n", constant.GetEmoji("BADGE1"), employee.MmaScore.MasteryScore.Round(1))
mmaScores += fmt.Sprintf("%v `Meaning. `%v\n", constant.GetEmoji("BADGE2"), employee.MmaScore.MeaningScore.Round(1))
mmaScores += fmt.Sprintf("%v `Autonomy. `%v\n", constant.GetEmoji("BADGE3"), employee.MmaScore.AutonomyScore.Round(1))

userInfo += "\n**MMA Scores**\n" + mmaScores

Expand Down
8 changes: 4 additions & 4 deletions pkg/model/employee.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ type Employee struct {
EndDate interface{} `json:"endDate"`
} `json:"projects"`
MmaScore struct {
MasteryScore string `json:"masteryScore"`
AutonomyScore string `json:"autonomyScore"`
MeaningScore string `json:"meaningScore"`
RatedAt time.Time `json:"ratedAt"`
MasteryScore decimal.Decimal `json:"masteryScore"`
AutonomyScore decimal.Decimal `json:"autonomyScore"`
MeaningScore decimal.Decimal `json:"meaningScore"`
RatedAt time.Time `json:"ratedAt"`
} `json:"mmaScore"`
}

Expand Down

0 comments on commit c5cb35f

Please sign in to comment.