mirror of
https://github.com/nikdoof/pacmanager.git
synced 2025-12-17 20:09:23 +00:00
Auto create the month summary
This commit is contained in:
@@ -11,9 +11,12 @@ def import_wallet_journal(corporation_id):
|
|||||||
corp = Corporation.objects.get(pk=corporation_id)
|
corp = Corporation.objects.get(pk=corporation_id)
|
||||||
api = EVEAPIConnection(cacheHandler=APICache.DjangoCacheHandler())
|
api = EVEAPIConnection(cacheHandler=APICache.DjangoCacheHandler())
|
||||||
|
|
||||||
|
# create current month
|
||||||
|
MonthTotal.objects.get_or_create(corporation=corp, year=now().year, month=now().month)
|
||||||
|
|
||||||
for key in corp.keys.all():
|
for key in corp.keys.all():
|
||||||
auth = api.auth(keyID=key.pk, vCode=key.vcode)
|
auth = api.auth(keyID=key.pk, vCode=key.vcode)
|
||||||
|
|
||||||
def get_records(corp=None, fromID=None, rowCount=2560):
|
def get_records(corp=None, fromID=None, rowCount=2560):
|
||||||
if fromID and fromID <= corp.last_transaction:
|
if fromID and fromID <= corp.last_transaction:
|
||||||
return None
|
return None
|
||||||
@@ -31,7 +34,7 @@ def import_wallet_journal(corporation_id):
|
|||||||
for row in rows._rows:
|
for row in rows._rows:
|
||||||
entries.append(row)
|
entries.append(row)
|
||||||
return entries
|
return entries
|
||||||
|
|
||||||
|
|
||||||
# Process Rows
|
# Process Rows
|
||||||
rows = get_records(corp)
|
rows = get_records(corp)
|
||||||
@@ -63,9 +66,9 @@ def process_corps():
|
|||||||
if corp.keys.count():
|
if corp.keys.count():
|
||||||
logging.info('Processing %s' % corp.name)
|
logging.info('Processing %s' % corp.name)
|
||||||
import_wallet_journal(corp.id)
|
import_wallet_journal(corp.id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def process_pac_wallet():
|
def process_pac_wallet():
|
||||||
paymentid = {}
|
paymentid = {}
|
||||||
for corp in Corporation.objects.all():
|
for corp in Corporation.objects.all():
|
||||||
@@ -73,7 +76,7 @@ def process_pac_wallet():
|
|||||||
|
|
||||||
if not 'payments.keyid' in managerconf or not 'payments.vcode' in managerconf:
|
if not 'payments.keyid' in managerconf or not 'payments.vcode' in managerconf:
|
||||||
logging.error('No payments Key ID / vCode set!')
|
logging.error('No payments Key ID / vCode set!')
|
||||||
return
|
return
|
||||||
|
|
||||||
api = EVEAPIConnection(cacheHandler=APICache.DjangoCacheHandler())
|
api = EVEAPIConnection(cacheHandler=APICache.DjangoCacheHandler())
|
||||||
auth = api.auth(keyID=managerconf['payments.keyid'], vCode=managerconf['payments.vcode'])
|
auth = api.auth(keyID=managerconf['payments.keyid'], vCode=managerconf['payments.vcode'])
|
||||||
|
|||||||
Reference in New Issue
Block a user