diff --git a/bin/export-pion b/bin/export-pion index 9e0ffe4969706cfaa5269c41b816ac714eaef706..04a059bc8cf222ffc5b67c2c44aa182185d703d4 100755 --- a/bin/export-pion +++ b/bin/export-pion @@ -27,12 +27,14 @@ res = (sess.query(db.Participant, db.Participation, db.Contest, db.Round) class Row: rocnik: str = "" kategorie: str = "" + kolo_seq: str = "" kolo: str = "" misto: str = "" kod_mista: str = "" kod_ucastnika: str = "" nazev_skoly: str = "" kod_skoly: str = "" + mesto_skoly: str = "" kraj_skoly: str = "" @@ -41,14 +43,16 @@ for pant, pion, ct, rnd in res: output.append(Row( rocnik=str(rnd.year), kategorie=rnd.category, - kolo=str(rnd.seq), + kolo_seq=str(rnd.seq), + kolo=rnd.name, misto=ct.place.name, kod_mista=str(ct.place.place_id), kod_ucastnika=str(pion.user_id), nazev_skoly=pant.school_place.name, kod_skoly=str(pant.school), + mesto_skoly=pant.school_place.parent_place.name, kraj_skoly=pant.school_place.parent_place.parent_place.parent_place.name, )) -output.sort(key=lambda o: (o.rocnik, o.kategorie, o.kolo, o.kod_mista, o.kod_ucastnika)) +output.sort(key=lambda o: (o.rocnik, o.kategorie, o.kolo_seq, o.kod_mista, o.kod_ucastnika)) mo.csv.write(sys.stdout, mo.csv.FileFormat.en_csv, Row, output)