WIP: Aureplop/kpsul js refactor #501
1 changed files with 23 additions and 0 deletions
|
@ -1603,6 +1603,29 @@ def perform_transfers(request):
|
||||||
transfer.save()
|
transfer.save()
|
||||||
data['transfers'].append(transfer.pk)
|
data['transfers'].append(transfer.pk)
|
||||||
|
|
||||||
|
# Websocket data
|
||||||
|
websocket_data = {}
|
||||||
|
websocket_data['opegroups'] = [{
|
||||||
|
'add': True,
|
||||||
|
'type': 'transfergroup',
|
||||||
|
'id': transfergroup.pk,
|
||||||
|
'at': transfergroup.at,
|
||||||
|
'comment': transfergroup.comment,
|
||||||
|
'valid_by__trigramme': ( transfergroup.valid_by and
|
||||||
|
transfergroup.valid_by.trigramme or None),
|
||||||
|
'opes': [],
|
||||||
|
}]
|
||||||
|
for transfer in transfers:
|
||||||
|
ope_data = {
|
||||||
|
'id': transfer.pk,
|
||||||
|
'amount': transfer.amount,
|
||||||
|
'from_acc': transfer.from_acc.trigramme,
|
||||||
|
'to_acc': transfer.to_acc.trigramme,
|
||||||
|
'canceled_by__trigramme': None, 'canceled_at': None,
|
||||||
|
}
|
||||||
|
websocket_data['opegroups'][0]['opes'].append(ope_data)
|
||||||
|
|
||||||
|
consumers.KPsul.group_send('kfet.kpsul', websocket_data)
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue