Skip to content
Permalink
Browse files

Update classes of riders in the ÖTSV Cup

Add a script to update the classes or riders in the ÖTSV Cup
due to age limits.
  • Loading branch information...
Andreas Gruenbacher
Andreas Gruenbacher committed Jan 26, 2019
1 parent 42c7f2e commit 5b5172d2b17ce51edb58200652b5e7ccfc03dd01
Showing with 19 additions and 0 deletions.
  1. +19 −0 otsv-update-classes
@@ -0,0 +1,19 @@
#! /bin/sh

id=$1
current_year=$(date +%Y)

cat <<EOF
UPDATE riders
SET class = class + 1, version = version + 1
WHERE id = $id AND class IN (3, 6) AND YEAR(date_of_birth) < $((current_year - 45));
UPDATE riders
SET class = class + 1, version = version + 1
WHERE id = $id AND class = 5 AND YEAR(date_of_birth) < $((current_year - 12));
UPDATE riders
SET class = class - 1, version = version - 1
WHERE id = $id AND class = 12 AND YEAR(date_of_birth) < $((current_year - 18));
UPDATE riders
SET class = class - 1, version = version - 1
WHERE id = $id AND class = 13 AND YEAR(date_of_birth) < $((current_year - 16));
EOF

0 comments on commit 5b5172d

Please sign in to comment.
You can’t perform that action at this time.