diff options
author | emkael <emkael@tlen.pl> | 2021-06-12 20:59:53 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2021-06-12 21:05:32 +0200 |
commit | aa80a70ca494f5063c5b19cceb3ea8b0caa31694 (patch) | |
tree | 83db020706400c0a4e3f9ebf3574bafa3fe63cd8 /dumps/check-teams.sh | |
parent | 4b7d785ee64b1ef9590eacf47ea91ec6c8b3c0ec (diff) |
Player-team checks with magic Cezar CSV
Diffstat (limited to 'dumps/check-teams.sh')
-rwxr-xr-x | dumps/check-teams.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dumps/check-teams.sh b/dumps/check-teams.sh new file mode 100755 index 0000000..ecf78a5 --- /dev/null +++ b/dumps/check-teams.sh @@ -0,0 +1,28 @@ +#!/bin/bash +DBNAME=$1 +PLAYERSDB=${LIGA_PLAYERS_DB_NAME} +echo $DBNAME +cat .cezar-teams-$DBNAME | while read TEAM CEZARTEAM +do + echo "UPDATE teams SET internet = $CEZARTEAM WHERE id = $TEAM;" +done | mysql ${LIGA_MYSQL_CONNECTION_OPTS} $DBNAME +QUERY="SELECT dmppl.link, CONCAT(dmppl.gname, ' ', dmppl.sname), TRIM(t.shortname), TRIM(pl.loc2), CONCAT(lineup.rnd, '-', lineup.segment) FROM $DBNAME.players dmppl JOIN $PLAYERSDB.players pl ON dmppl.link = pl.ID JOIN $DBNAME.teams t ON t.id = dmppl.team JOIN ( +SELECT rnd, segment, openN as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, openS as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, openE as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, openW as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, closeN as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, closeS as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, closeE as pl FROM $DBNAME.segments +UNION +SELECT rnd, segment, closeW as pl FROM $DBNAME.segments +) lineup ON lineup.pl = dmppl.id +WHERE t.internet <> pl.info +ORDER BY dmppl.link, lineup.rnd, lineup.segment;" +echo $QUERY | mysql ${LIGA_MYSQL_CONNECTION_OPTS} -N |