mirror of https://github.com/dirtbags/moth.git
Merge branch 'master' of https://github.com/dirtbags/moth
This commit is contained in:
commit
4f4cd7a2ad
2
build.sh
2
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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue