Add more address information in export
This commit is contained in:
parent
89dbaeb092
commit
fcbcf01d00
3 changed files with 14 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
from verein import Verein
|
||||
|
||||
TABLE_HEADING = "account_name,total_balance,available_balance,redeemed"
|
||||
TABLE_HEADING = "account_name,address,post_code,city,total_balance,available_balance,redeemed"
|
||||
|
||||
|
||||
def export_vereine(vereine: [Verein], export_filename: str):
|
||||
|
@ -13,4 +13,5 @@ def export_vereine(vereine: [Verein], export_filename: str):
|
|||
|
||||
|
||||
def line_for_verein(verein: Verein):
|
||||
return f'{verein.account_name},{verein.total_balance},{verein.available_balance},{verein.redeemed}'
|
||||
return f'"{verein.account_name}","{verein.address}",{verein.post_code},"{verein.city}",' \
|
||||
f'{verein.total_balance},{verein.available_balance},{verein.redeemed}'
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
class Verein:
|
||||
account_name: str
|
||||
address: str
|
||||
post_code: int
|
||||
city: str
|
||||
total_balance: int
|
||||
available_balance: int
|
||||
redeemed: int
|
||||
|
||||
def __init__(self, account_name: str, total_balance: int, available_balance: int, redeemed: int):
|
||||
def __init__(self, account_name: str, address: str, city: str, post_code: int, total_balance: int,
|
||||
available_balance: int, redeemed: int):
|
||||
self.account_name = account_name
|
||||
self.address = address
|
||||
self.post_code = post_code
|
||||
self.city = city
|
||||
self.total_balance = total_balance
|
||||
self.available_balance = available_balance
|
||||
self.redeemed = redeemed
|
||||
|
|
|
@ -20,4 +20,6 @@ def get_verein_for_id(verein_id: int) -> Verein:
|
|||
raise RuntimeError
|
||||
|
||||
data = response.json()['data']
|
||||
return Verein(data['accountName'], data['totalBalance'], data['availableBalance'], data['redeemed'])
|
||||
address = data['address']
|
||||
return Verein(data['accountName'], address['address'], address['city'], address['postCode'], data['totalBalance'],
|
||||
data['availableBalance'], data['redeemed'])
|
||||
|
|
Loading…
Reference in a new issue