This commit is contained in:
Neale Pickett 2018-09-24 20:00:21 +00:00
commit fab2470975
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
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

View File

@ -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
}

View File

@ -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
}