diff --git a/build.sh b/build.sh index 583fc7c..12792c2 100755 --- a/build.sh +++ b/build.sh @@ -7,5 +7,5 @@ version=$(date +%Y%m%d%H%M) for img in moth moth-devel; do echo "==== $img" docker build --build-arg http_proxy=$http_proxy --tag dirtbags/$img --tag dirtbags/$img:$version -f Dockerfile.$img . - [ "$1" = "--push" ] && docker push dirtbags/$img:$version && docker push dirtbags/$img + [ "$1" = "-push" ] && docker push dirtbags/$img:$version && docker push dirtbags/$img done diff --git a/src/handlers.go b/src/handlers.go index 8eec570..b5e6590 100644 --- a/src/handlers.go +++ b/src/handlers.go @@ -270,8 +270,8 @@ func (ctx *Instance) answerHandler(w http.ResponseWriter, req *http.Request) { if err := ctx.AwardPoints(teamid, category, points); err != nil { respond( w, req, Error, - "Error awarding points", - err.Error(), + "Cannot award points", + "The answer is correct, but there was an error awarding points: %v", err.Error(), ) return } diff --git a/src/instance.go b/src/instance.go index 1c18de1..4a73e03 100644 --- a/src/instance.go +++ b/src/instance.go @@ -131,6 +131,11 @@ func (ctx *Instance) AwardPoints(teamid, category string, points int) error { Points: points, } + teamName, err := ctx.TeamName(teamid) + if err != nil { + return fmt.Errorf("No registered team with this hash") + } + for _, e := range ctx.PointsLog() { if a.Same(e) { return fmt.Errorf("Points already awarded to this team in this category") @@ -150,7 +155,7 @@ func (ctx *Instance) AwardPoints(teamid, category string, points int) error { } ctx.update <- true - log.Printf("Award %s %s %d", teamid, category, points) + log.Printf("Award %s %s %d", teamName, category, points) return nil }