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
|
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
|
||||||
|
|
|
@ -270,8 +270,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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue