Merge branch 'mothv3'

This commit is contained in:
Neale Pickett 2018-09-23 03:38:32 +00:00
commit 1b4767543b
3 changed files with 9 additions and 4 deletions

View File

@ -7,5 +7,5 @@ version=$(date +%Y%m%d%H%M)
for img in moth moth-devel; do for img in moth moth-devel; do
echo "==== $img" echo "==== $img"
docker build --build-arg http_proxy=$http_proxy --tag dirtbags/$img --tag dirtbags/$img:$version -f Dockerfile.$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 done

View File

@ -197,8 +197,8 @@ func (ctx *Instance) answerHandler(w http.ResponseWriter, req *http.Request) {
if err := ctx.AwardPoints(teamid, category, points); err != nil { if err := ctx.AwardPoints(teamid, category, points); err != nil {
respond( respond(
w, req, Error, w, req, Error,
"Error awarding points", "Cannot award points",
err.Error(), "The answer is correct, but there was an error awarding points: %v", err.Error(),
) )
return return
} }

View File

@ -131,6 +131,11 @@ func (ctx *Instance) AwardPoints(teamid, category string, points int) error {
Points: points, Points: points,
} }
teamName, err := ctx.TeamName(teamid)
if err != nil {
return fmt.Errorf("No registered team with this hash")
}
for _, e := range ctx.PointsLog() { for _, e := range ctx.PointsLog() {
if a.Same(e) { if a.Same(e) {
return fmt.Errorf("Points already awarded to this team in this category") 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 ctx.update <- true
log.Printf("Award %s %s %d", teamid, category, points) log.Printf("Award %s %s %d", teamName, category, points)
return nil return nil
} }