mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
some fixes for the eye and adaption to gradido node errors
This commit is contained in:
parent
286a5db44f
commit
518595d5ba
@ -93,9 +93,13 @@ class JsonRequestHandlerController extends AppController {
|
||||
if(!$last_transaction_query->isEmpty()) {
|
||||
$last_transaction_id = $last_transaction_query->first()->id;
|
||||
}
|
||||
$last_known_sequence_number = $last_transaction_id;
|
||||
|
||||
if($last_transaction_query->count() < $last_transaction_id) {
|
||||
$last_transaction_id = $last_transaction_query->count();
|
||||
}
|
||||
$last_transaction_id = 0;
|
||||
|
||||
|
||||
$group_alias = Configure::read('GroupAlias');
|
||||
$result = (array)$this->JsonRpcRequestClient->request('getTransactions', ['groupAlias' => $group_alias, 'lastKnownSequenceNumber' => $last_transaction_id]);
|
||||
@ -239,7 +243,9 @@ class JsonRequestHandlerController extends AppController {
|
||||
$temp_record = new Record;
|
||||
$errors = [];
|
||||
foreach($result['blocks'] as $_record) {
|
||||
if(is_string($_record)) continue;
|
||||
$parse_result = $temp_record->parseRecord($_record);
|
||||
|
||||
if($parse_result == true) {
|
||||
$sequenceNumber = $temp_record->getSequenceNumber();
|
||||
if($part_count == -1) {
|
||||
@ -248,10 +254,13 @@ class JsonRequestHandlerController extends AppController {
|
||||
$part_count--;
|
||||
|
||||
if($part_count == 0) {
|
||||
$finalize_result = $temp_record->finalize();
|
||||
if($finalize_result !== true) {
|
||||
$errors[] = ['msg' => 'error in finalize', 'record' => $_record, 'details' => $finalize_result, 'sequenceNumber' => $sequenceNumber];
|
||||
if($sequenceNumber > $last_known_sequence_number) {
|
||||
$finalize_result = $temp_record->finalize();
|
||||
if($finalize_result !== true) {
|
||||
$errors[] = ['msg' => 'error in finalize', 'record' => $_record, 'details' => $finalize_result, 'sequenceNumber' => $sequenceNumber];
|
||||
}
|
||||
}
|
||||
|
||||
$temp_record = new Record;
|
||||
$part_count = -1;
|
||||
}
|
||||
|
||||
@ -57,8 +57,9 @@ class TransactionSendCoinsController extends AppController
|
||||
'contain' => ['Transactions', 'StateUsers', 'ReceiverUsers']
|
||||
];
|
||||
$transactionSendCoins = $this->paginate($this->TransactionSendCoins);
|
||||
$simple = $this->TransactionSendCoins->find('all');
|
||||
|
||||
$this->set(compact('transactionSendCoins'));
|
||||
$this->set(compact('transactionSendCoins', 'simple'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -63,24 +63,6 @@ class GradidoModifieUserBalance
|
||||
{
|
||||
$userPublicBin = hex2bin($userPublicKey);
|
||||
$stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers');
|
||||
|
||||
// hack for pauls public key format with many FF instead of the real values
|
||||
$stateUsers = $stateUsersTable->find('all')->select(['id', 'public_key']);
|
||||
$debug_user_publics = [];
|
||||
foreach($stateUsers as $user) {
|
||||
$user_public = stream_get_contents($user->public_key);
|
||||
$debug_user_publics[] = bin2hex($user_public);
|
||||
if(($user_public & $userPublicBin) == $user_public) {
|
||||
array_push($this->state_users, (int)$user->id);
|
||||
return $user->id;
|
||||
}
|
||||
}
|
||||
return [
|
||||
'state' => 'error',
|
||||
'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key binary &',
|
||||
'details' => ['input public' => $userPublicKey, 'user publics' => $debug_user_publics]
|
||||
];
|
||||
// hack end
|
||||
|
||||
$stateUser = $stateUsersTable->find('all')->where(['public_key' => hex2bin($userPublicKey)]);
|
||||
if($stateUser->isEmpty()) {
|
||||
@ -342,7 +324,7 @@ class GradidoTransfer extends GradidoModifieUserBalance
|
||||
}
|
||||
}
|
||||
if(is_int($receiver_id) && $receiver_id > 0) {
|
||||
$this->state_users[] = $receiver_id;
|
||||
$transferEntity->receiver_user_id = $receiver_id;
|
||||
$balance_result = $this->updateBalance($this->receiver_new_balance, $received, $receiver_id);
|
||||
if(is_array($balance_result)) {
|
||||
return $balance_result;
|
||||
@ -397,7 +379,6 @@ class Record
|
||||
case 'BLANK':
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@ -16,14 +16,15 @@
|
||||
</nav>
|
||||
<div class="transactionCreations index large-9 medium-8 columns content">
|
||||
<h3><?= __('Transaction Creations') ?></h3>
|
||||
<table cellpadding="0" cellspacing="0" style="table-layout: auto;">
|
||||
<table cellpadding="5" cellspacing="0" style="table-layout: auto;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('state_user_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('target_date') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('received') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('amount') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('ident_hash ') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -33,6 +34,8 @@
|
||||
<td><?= $this->Number->format($transactionCreation->id) ?></td>
|
||||
<td><?= $transactionCreation->has('transaction') ? $this->Html->link($transactionCreation->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $transactionCreation->transaction->id]) : '' ?></td>
|
||||
<td><?= $transactionCreation->has('state_user') ? $this->Html->link($transactionCreation->state_user->getEmailWithName(), ['controller' => 'StateUsers', 'action' => 'view', $transactionCreation->state_user->id]) : '' ?></td>
|
||||
<td><?= h($transactionCreation->target_date) ?></td>
|
||||
<td><?= h($transactionCreation->transaction->received) ?></td>
|
||||
<td><?= $this->element('printGradido', ['number' => $transactionCreation->amount]) ?></td>
|
||||
<td><?= stream_get_contents($transactionCreation->ident_hash) ?></td>
|
||||
<td class="actions">
|
||||
|
||||
@ -4,8 +4,7 @@
|
||||
* @var \App\Model\Entity\TransactionSendCoin[]|\Cake\Collection\CollectionInterface $transactionSendCoins
|
||||
*/
|
||||
?>
|
||||
<nav id="actions-sidebar">
|
||||
index.ctp
|
||||
<nav id="actions-sidebar">
|
||||
<ul class="nav-horizontal nav-smaller">
|
||||
<li class="heading"><?= __('Actions') ?></li>
|
||||
<li><?= $this->Html->link(__('New Transaction Send Coin'), ['action' => 'add']) ?></li>
|
||||
@ -17,24 +16,26 @@
|
||||
</nav>
|
||||
<div class="transactionSendCoins index large-9 medium-8 columns content">
|
||||
<h3><?= __('Transaction Send Coins') ?></h3>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('transaction_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('state_user_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('receiver_user_id') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('amount') ?></th>
|
||||
<th scope="col"><?= $this->Paginator->sort('sender_final_balance') ?></th>
|
||||
<th scope="col" class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($transactionReceiveCoins as $transactionSendCoin): ?>
|
||||
<?php foreach ($transactionSendCoins as $transactionSendCoin): ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($transactionSendCoin->id) ?></td>
|
||||
<td><?= $transactionSendCoin->has('transaction') ? $this->Html->link($transactionSendCoin->transaction->id, ['controller' => 'Transactions', 'action' => 'view', $transactionSendCoin->transaction->id]) : '' ?></td>
|
||||
<td><?= $transactionSendCoin->has('state_user') ? $this->Html->link($transactionSendCoin->state_user->getEmailWithName(), ['controller' => 'StateUsers', 'action' => 'view', $transactionSendCoin->state_user->id]) : '' ?></td>
|
||||
<td><?= $this->Number->format($transactionSendCoin->amount) ?></td>
|
||||
<td><?= $transactionSendCoin->has('receiver_user') ? $this->Html->link($transactionSendCoin->receiver_user->getEmailWithName(), ['controller' => 'StateUsers', 'action' => 'view', $transactionSendCoin->receiver_user->id]) : ''?></td>
|
||||
<td><?= $this->element('printGradido', ['number' => $transactionSendCoin->amount]) ?></td>
|
||||
<td><?= $this->Number->format($transactionSendCoin->sender_final_balance) ?></td>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $transactionSendCoin->id]) ?>
|
||||
|
||||
@ -30,15 +30,19 @@
|
||||
</nav>
|
||||
<div class="content-list transactions">
|
||||
<div class="content-list-table transactions">
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('id') ?></div>
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('memo') ?></div>
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('transaction_type_id') ?></div>
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('received') ?></div>
|
||||
<div class="row">
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('id') ?></div>
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('memo') ?></div>
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('transaction_type_id') ?></div>
|
||||
<div class="cell header-cell"><?= $this->Paginator->sort('received') ?></div>
|
||||
</div>
|
||||
<?php foreach ($transactions as $transaction): ?>
|
||||
<div class="cell"><?= $this->Number->format($transaction->id) ?></div>
|
||||
<div class="cell"><?= h($transaction->memo) ?></div>
|
||||
<div class="cell"><?= $transaction->has('transaction_type') ? $this->Html->link(__($transaction->transaction_type->name), ['controller' => 'TransactionTypes', 'action' => 'view', $transaction->transaction_type->id]) : '' ?></div>
|
||||
<div class="cell"><?= h($transaction->received) ?></div>
|
||||
<div class="row">
|
||||
<div class="cell"><?= $this->Number->format($transaction->id) ?></div>
|
||||
<div class="cell"><?= h($transaction->memo) ?></div>
|
||||
<div class="cell"><?= $transaction->has('transaction_type') ? $this->Html->link(__($transaction->transaction_type->name), ['controller' => 'TransactionTypes', 'action' => 'view', $transaction->transaction_type->id]) : '' ?></div>
|
||||
<div class="cell"><?= h($transaction->received) ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 81a461566e46d71533dc3e284fa075d7d68fd020
|
||||
Subproject commit 9004e6978ac3dafcc635b2ffcf8bc6a156451cca
|
||||
Loading…
x
Reference in New Issue
Block a user