From 593eb77c0a79ac2e1b8ae276b9685c7097ea7606 Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Mon, 26 Jul 2021 18:13:29 +0000 Subject: [PATCH 01/27] update list GDT API Call --- .../src/Controller/AppRequestsController.php | 55 ++++++++++++++++++- .../Controller/StateBalancesController.php | 1 - 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index 271265257..346efc544 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -25,7 +25,10 @@ class AppRequestsController extends AppController $this->loadComponent('GradidoNumber'); //$this->loadComponent('JsonRpcRequestClient'); //$this->Auth->allow(['add', 'edit']); - $this->Auth->allow(['index', 'sendCoins', 'createCoins', 'getBalance', 'listTransactions', 'getDecayStartBlock']); + $this->Auth->allow([ + 'index', 'sendCoins', 'createCoins', 'getBalance', + 'listTransactions','listGDTTransactions', 'getDecayStartBlock' + ]); } @@ -403,6 +406,56 @@ class AppRequestsController extends AppController $this->set('body', $body); } + public function listGDTTransactions($page = 1, $count = 25, $orderDirection = 'ASC', $session_id = 0) + { + $timeBegin = microtime(true); + $gdtSum = 0; + $gdtCount = -1; + $this->viewBuilder()->setLayout('ajax'); + + $login_result = $this->requestLogin($session_id, false); + + if($login_result !== true) { + return $this->returnJson($login_result); + } + $session = $this->getRequest()->getSession(); + $user = $session->read('StateUser'); + + if(!$user) { + return $this->returnJson(['state' => 'error', 'msg' => 'user not found', 'details' => 'exist a valid session cookie?']); + } + $gdtEntries = $this->JsonRequestClient->sendRequestGDT([ + 'email' => $user['email'], + 'page' => $page, + 'count' => $count, + 'orderDirection' => $orderDirection + ], 'GdtEntries' . DS . 'sumPerEmailApi'); + //var_dump($gdtEntries); + $transactions = []; + if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { + $gdtSum = intval($gdtEntries['data']['sum']); + if(isset($gdtEntries['data']['count'])) { + $gdtCount = intval($gdtEntries['data']['count']); + } + if(isset($gdtEntries['data']['ownEntries'])) { + $transactions = $gdtEntries['data']['ownEntries']; + } + } else { + if($user) { + $this->addAdminError('StateBalancesController', 'ajaxGdtOverview', $gdtEntries, $user['id']); + } else { + $this->addAdminError('StateBalancesController', 'ajaxGdtOverview', $gdtEntries, 0); + } + } + $timeEnd = microtime(true); + return $this->returnJson([ + 'state' => 'success', + 'transactions' => $transactions, + 'count' => $gdtEntries['data']['count'], + 'timeUsed' => ($timeEnd - $timeBegin) . ' s' + ]); + } + public function getDecayStartBlock() { $transactionsTable = TableRegistry::getTableLocator()->get('Transactions'); diff --git a/community_server/src/Controller/StateBalancesController.php b/community_server/src/Controller/StateBalancesController.php index 5dcc14f02..a87af5e48 100644 --- a/community_server/src/Controller/StateBalancesController.php +++ b/community_server/src/Controller/StateBalancesController.php @@ -94,7 +94,6 @@ class StateBalancesController extends AppController $gdtSum = 0; $gdtEntries = $this->JsonRequestClient->sendRequestGDT(['email' => $user['email']], 'GdtEntries' . DS . 'sumPerEmailApi'); - if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { $gdtSum = intval($gdtEntries['data']['sum']); } else { From 1dd3d427531497c10792c6a4e1e98166d623fa6d Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Tue, 27 Jul 2021 10:57:16 +0000 Subject: [PATCH 02/27] remove double call of sumPerEmailApi --- .../Controller/StateBalancesController.php | 25 ++----------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/community_server/src/Controller/StateBalancesController.php b/community_server/src/Controller/StateBalancesController.php index a87af5e48..f150be489 100644 --- a/community_server/src/Controller/StateBalancesController.php +++ b/community_server/src/Controller/StateBalancesController.php @@ -65,33 +65,12 @@ class StateBalancesController extends AppController if($update_balance_result['success'] !== true) { $this->addAdminError('StateBalances', 'overview', $update_balance_result, $user['id']); } - - // sendRequestGDT - // listPerEmailApi - - $gdtSum = 0; - //if('admin' === $user['role']) { - $gdtEntries = $this->JsonRequestClient->sendRequestGDT(['email' => $user['email']], 'GdtEntries' . DS . 'sumPerEmailApi'); - //var_dump($gdtEntries); - if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { - $gdtSum = intval($gdtEntries['data']['sum']); - } else { - if($user) { - $this->addAdminError('StateBalancesController', 'overview', $gdtEntries, $user['id']); - } else { - $this->addAdminError('StateBalancesController', 'overview', $gdtEntries, 0); - } - } - //} - // - // + $stateBalancesTable = TableRegistry::getTableLocator()->get('StateBalances'); $stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions'); - $transactionsTable = TableRegistry::getTableLocator()->get('Transactions'); - + $transactionsTable = TableRegistry::getTableLocator()->get('Transactions'); $stateBalancesTable->updateBalances($user['id']); - $gdtSum = 0; $gdtEntries = $this->JsonRequestClient->sendRequestGDT(['email' => $user['email']], 'GdtEntries' . DS . 'sumPerEmailApi'); if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { From e3f9a83ec55bc0aeec8c349961d562681323b1aa Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 3 Aug 2021 17:17:45 +0200 Subject: [PATCH 03/27] step 1 --- .../admin_transactionGdt_list.json | 45 +++++++++++++ frontend/src/apis/communityAPI.js | 7 ++ .../src/views/Layout/DashboardLayout_gdd.vue | 65 ++++++++++++++++++- .../AccountOverview/GddTransactionGdtList.vue | 46 +++++++++++++ .../Pages/UserProfileTransactionList.vue | 9 +++ 5 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 frontend/public/json-example/admin_transactionGdt_list.json create mode 100644 frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue diff --git a/frontend/public/json-example/admin_transactionGdt_list.json b/frontend/public/json-example/admin_transactionGdt_list.json new file mode 100644 index 000000000..0fab48c11 --- /dev/null +++ b/frontend/public/json-example/admin_transactionGdt_list.json @@ -0,0 +1,45 @@ +{"state":"success", "gdt": + [ + { + "id": 8821, + "amount": 1000, + "date": "2020-08-12T14:12:00+00:00", + "email": "foerderkreis-1@gradido.org", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": "20.0000", + "amount2": 0, + "factor2": "0.0500", + "gdt": 1000 + }, + { + "id": 8552, + "amount": 1000, + "date": "2020-06-17T14:12:00+00:00", + "email": "foerderkreis-1@gradido.org", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": "20.0000", + "amount2": 0, + "factor2": "0.0500", + "gdt": 1000 + }, + { + "id": 8317, + "amount": 1000, + "date": "2020-03-16T14:12:00+00:00", + "email": "foerderkreis-1@gradido.org", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": "20.0000", + "amount2": 0, + "factor2": "0.0500", + "gdt": 1000 + } + ], + "transactionExecutingCount": 3000, + "count": 3 +} \ No newline at end of file diff --git a/frontend/src/apis/communityAPI.js b/frontend/src/apis/communityAPI.js index b2df337b8..65b9d40b9 100644 --- a/frontend/src/apis/communityAPI.js +++ b/frontend/src/apis/communityAPI.js @@ -40,6 +40,13 @@ const communityAPI = { `${CONFIG.COMMUNITY_API_URL}listTransactions/${firstPage}/${items}/${order}/${sessionId}`, ) }, + transactionsGdt: async (sessionId, firstPage = 1, items = 5, order = 'DESC') => { + return apiGet( + `${CONFIG.COMMUNITY_API_URL}state-balances/ajaxGdtOverview/${firstPage}/${items}/${order}/${sessionId}`, + ) + }, + //http://localhost/vue/public/json-example/admin_transactionGdt_list.json + //http://localhost/state-balances/ajaxGdtOverview /* create: async (sessionId, email, amount, memo, target_date = new Date() ) => { const payload = { sessionId, diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 1bde53e60..302fe5039 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -58,10 +58,14 @@ :pending="pending" @update-balance="updateBalance" @update-transactions="updateTransactions" + @updateGdt="updateGdt" + :transactionsGdt="transactionsGdt" + > + @@ -75,6 +79,7 @@ import ContentFooter from './ContentFooter.vue' import { FadeTransition } from 'vue2-transitions' import communityAPI from '../../apis/communityAPI' import VueQrcode from 'vue-qrcode' +//import { gdt } from '../../../public/json-example/admin_transactionGdt_list.json' function hasElement(className) { return document.getElementsByClassName(className).length > 0 @@ -106,7 +111,8 @@ export default { bookedBalance: 0, transactionCount: 0, pending: true, - } + transactionsGdt: [], + } }, methods: { initScrollbar() { @@ -141,12 +147,69 @@ export default { // what to do when loading balance fails? } }, + async updateGdt(){ + //this.transactionsGdt = gdt + // const result = await communityAPI.transactionsGdt( + // this.$store.state.sessionId + // ) + + this.transactionsGdt = [{"state":"success", "gdt": + [ + { + "id": 8821, + "amount": 1000, + "date": "2020-08-12T14:12:00+00:00", + "email": "foerderkreis-1@gradido.org", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": "20.0000", + "amount2": 0, + "factor2": "0.0500", + "gdt": 1000 + }, + { + "id": 8552, + "amount": 1000, + "date": "2020-06-17T14:12:00+00:00", + "email": "foerderkreis-1@gradido.org", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": "20.0000", + "amount2": 0, + "factor2": "0.0500", + "gdt": 1000 + }, + { + "id": 8317, + "amount": 1000, + "date": "2020-03-16T14:12:00+00:00", + "email": "foerderkreis-1@gradido.org", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": "20.0000", + "amount2": 0, + "factor2": "0.0500", + "gdt": 1000 + } + ], + "transactionGdtExecutingCount": 3000, + "count": 3 +}] + + //console.log("DashboardLayout_gdd.vue") + //console.log(this.result) + }, updateBalance(ammount) { this.balance -= ammount }, }, mounted() { this.initScrollbar() + this.updateGdt() + console.log(this.transactionsGdt) }, } diff --git a/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue b/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue new file mode 100644 index 000000000..775d4b70e --- /dev/null +++ b/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue @@ -0,0 +1,46 @@ + + + + diff --git a/frontend/src/views/Pages/UserProfileTransactionList.vue b/frontend/src/views/Pages/UserProfileTransactionList.vue index e6a25b436..75d296306 100644 --- a/frontend/src/views/Pages/UserProfileTransactionList.vue +++ b/frontend/src/views/Pages/UserProfileTransactionList.vue @@ -10,6 +10,7 @@ :show-pagination="true" @update-transactions="updateTransactions" /> + @@ -17,17 +18,22 @@ From c4a01aec7383215574bdf04e5903d1dcad25f383 Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Tue, 3 Aug 2021 15:44:51 +0000 Subject: [PATCH 04/27] fill missing lines of list gdt transactions --- .../src/Controller/AppRequestsController.php | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index 346efc544..1ca96b3f8 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -424,21 +424,35 @@ class AppRequestsController extends AppController if(!$user) { return $this->returnJson(['state' => 'error', 'msg' => 'user not found', 'details' => 'exist a valid session cookie?']); } + $gdtEntries = $this->JsonRequestClient->sendRequestGDT([ 'email' => $user['email'], 'page' => $page, 'count' => $count, 'orderDirection' => $orderDirection - ], 'GdtEntries' . DS . 'sumPerEmailApi'); - //var_dump($gdtEntries); + ], 'GdtEntries' . DS . 'listPerEmailApi'); + $transactions = []; + $result = ['state' => 'success']; if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { - $gdtSum = intval($gdtEntries['data']['sum']); + $gdtSum = 0; + if(isset($gdtEntries['data']['gdtSumPerEmail'])) { + foreach($gdtEntries['data']['gdtSumPerEmail'] as $email => $sum) { + $gdtSum += floatval($sum/100.0); + } + } + $result['sum'] = $gdtSum; if(isset($gdtEntries['data']['count'])) { - $gdtCount = intval($gdtEntries['data']['count']); + $result['count'] = intval($gdtEntries['data']['count']); } if(isset($gdtEntries['data']['ownEntries'])) { - $transactions = $gdtEntries['data']['ownEntries']; + $result['ownEntries'] = $gdtEntries['data']['ownEntries']; + } + if(isset($gdtEntries['data']['publisherPath'])) { + $result['publisherPath'] = $gdtEntries['data']['publisherPath']; + } + if(isset($gdtEntries['data']['connectEntrys'])) { + $result['connectEntrys'] = $gdtEntries['data']['connectEntrys']; } } else { if($user) { @@ -448,12 +462,9 @@ class AppRequestsController extends AppController } } $timeEnd = microtime(true); - return $this->returnJson([ - 'state' => 'success', - 'transactions' => $transactions, - 'count' => $gdtEntries['data']['count'], - 'timeUsed' => ($timeEnd - $timeBegin) . ' s' - ]); + + $result['timeUsed'] = ($timeEnd - $timeBegin) . ' s'; + return $this->returnJson($result); } public function getDecayStartBlock() From 343789c30911bdf5e0bde2c4c6c871b973d33149 Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Thu, 5 Aug 2021 11:18:31 +0000 Subject: [PATCH 05/27] handing over result from updated gdt server --- .../src/Controller/AppRequestsController.php | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index 1ca96b3f8..136b75080 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -434,26 +434,11 @@ class AppRequestsController extends AppController $transactions = []; $result = ['state' => 'success']; - if('success' == $gdtEntries['state'] && 'success' == $gdtEntries['data']['state']) { - $gdtSum = 0; - if(isset($gdtEntries['data']['gdtSumPerEmail'])) { - foreach($gdtEntries['data']['gdtSumPerEmail'] as $email => $sum) { - $gdtSum += floatval($sum/100.0); - } - } - $result['sum'] = $gdtSum; - if(isset($gdtEntries['data']['count'])) { - $result['count'] = intval($gdtEntries['data']['count']); - } - if(isset($gdtEntries['data']['ownEntries'])) { - $result['ownEntries'] = $gdtEntries['data']['ownEntries']; - } - if(isset($gdtEntries['data']['publisherPath'])) { - $result['publisherPath'] = $gdtEntries['data']['publisherPath']; - } - if(isset($gdtEntries['data']['connectEntrys'])) { - $result['connectEntrys'] = $gdtEntries['data']['connectEntrys']; - } + if('success' == $gdtEntries['state']) { + $timeEnd = microtime(true); + $gdtEntries['data']['timeUsed'] = $timeEnd - $timeBegin; + return $this->returnJson($gdtEntries['data']); + } else { if($user) { $this->addAdminError('StateBalancesController', 'ajaxGdtOverview', $gdtEntries, $user['id']); @@ -461,10 +446,7 @@ class AppRequestsController extends AppController $this->addAdminError('StateBalancesController', 'ajaxGdtOverview', $gdtEntries, 0); } } - $timeEnd = microtime(true); - - $result['timeUsed'] = ($timeEnd - $timeBegin) . ' s'; - return $this->returnJson($result); + return $this->returnJson(['state' => 'error', 'msg' => 'error by requesting gdt server', 'details' => $gdtEntries]); } public function getDecayStartBlock() From 402a0af5c1a0476c9f025c37cc0f1c84a8afca1c Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Thu, 5 Aug 2021 11:47:04 +0000 Subject: [PATCH 06/27] add doc --- docu/community-server.api.md | 110 +++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/docu/community-server.api.md b/docu/community-server.api.md index 64127dd81..9a153101d 100644 --- a/docu/community-server.api.md +++ b/docu/community-server.api.md @@ -125,6 +125,116 @@ Transaction: - `creation_amount`: only for creation transaction, created account before decay - `target_date`: only by creation transaction, target date for creation, start time for decay calculation (if < as global decay start time) +## List GDT Transactions +`GET http://localhost/api/listGDTTransactions/[1]/[25]/[DESC]/[session_id]` +Parts symbolized by [] are optional + - first parameter (1) is page for paging + - second parameter (25) is count for paging + - third parameter is ordering of resulting array, default is ASC + - fourth parameter is session_id (session will be searched in php session and GRADIDO_LOGIN cookie and if not found use this ) + +#### Paging +With count you say how many entrys you like to have in the result. +With page you say on which page you are. +For example 50 transactions are in db. +With 1/25 you get the first 25 transactions (1-25) +With 2/20 you get the second 20 transactions (21-40) + +### Response +Assuming session was valid and gdt server was setup correct +{ + "state": "success", + "count": 4, + "gdtEntries": [ + { + "id": 1, + "amount": 99, + "date": "2020-01-01T13:47:12+00:00", + "email": "dariofrodo@gmx.de", + "comment": "", + "coupon_code": null, + "gdt_entry_type_id": 1, + "factor": 18, + "amount2": 0, + "factor2": 1, + "gdt": 1782 + }, + { + "id": 10, + "amount": 100.12, + "date": "2021-07-28T13:58:00+00:00", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": 15, + "amount2": 0, + "factor2": 0.05, + "gdt": 75.09000000000002, + "publisher": { + "id": 12, + "first_name": "Dario", + "last_name": "Frodo", + "email": "dariofrodo@gmx.de" + } + }, + { + "id": 6, + "amount": 1782, + "date": "2021-07-30T13:21:46+00:00", + "email": "dariofrodo@gmx.de", + "comment": "Event 20-20", + "coupon_code": null, + "gdt_entry_type_id": 7, + "factor": 0.2, + "amount2": 0, + "factor2": 1, + "gdt": 356.40000000000006 + }, + { + "id": 8, + "amount": 10, + "date": "2021-07-31T13:58:00+00:00", + "comment": null, + "coupon_code": "", + "gdt_entry_type_id": 4, + "factor": 15, + "amount2": 0, + "factor2": 0.05, + "gdt": 7.5, + "publisher": { + "id": 12, + "first_name": "Dario", + "last_name": "Frodo", + "email": "dariofrodo@gmx.de" + } + } + ], + "gdtSum": 2220.99, + "timeUsed": 0.19156503677368165 +} + +- `count`: Count of total gdt transactions for user +- `gdtEntries`: array with gdt entries, sort by date + - `amount`: amount of payed money in euro, expect by gdt_entry_type_id = 7, then it is GDT Sum for Global Modificator time span + - `date`: date of transaction with let create gdt transaction, date for picking factor and Global Modificator + - `comment`: custom comment or Global Modificator name if gdt_entry_type_id = 7 + - `gdt_entry_type_id`: type of gdt entry + (1) Form: Single GDT Entry directly created by admin via formular + (2) CVS: Created by importing a CVS-List with multiple GDT Entries + (3) Elopage: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) + (4) Elopage Publisher: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) for publisher, containing publisher object + (5) Digistore: Automatic created by Digistore Transaction + (6) CVS2: Created by importing a CVS-List with multiple GDT Entries, other format (used by Bernds old Accounting Tool) + (7) Global Modificator: Global Modificator which grand percental bonus on GDT in possession in event time span + - `factor`: Mulitplication factor for calculating gdt, change(d) over time + - `amount2`: Bonus add amount for gdt, sparly used + - `factor2`: Bonus mulitplication factor used by elopage publisher entry + - `gdt`: GDT Value, calculatedt from other value: gdt = amount * factor * factor2 + amount2 + - `publisher`: exist only on Elopage Publisher (gdt_entry_type_id = 4) GDT Entries +- `gdtSum`: Total GDT Sum of user +- `timeUsed`: GDT Server isn't optimized, this is for easy checking if it is still fast enough + + ## Creation transaction Makes a creation transaction to create new Gradido From 79f80e2af8742657f4acfb39f15b5de4ea31b96e Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Thu, 5 Aug 2021 12:12:50 +0000 Subject: [PATCH 07/27] update doc --- docu/community-server.api.md | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/docu/community-server.api.md b/docu/community-server.api.md index 9a153101d..5bdb468bb 100644 --- a/docu/community-server.api.md +++ b/docu/community-server.api.md @@ -163,19 +163,14 @@ Assuming session was valid and gdt server was setup correct "id": 10, "amount": 100.12, "date": "2021-07-28T13:58:00+00:00", + "email": "tester2@gmail.com", "comment": null, "coupon_code": "", "gdt_entry_type_id": 4, "factor": 15, "amount2": 0, "factor2": 0.05, - "gdt": 75.09000000000002, - "publisher": { - "id": 12, - "first_name": "Dario", - "last_name": "Frodo", - "email": "dariofrodo@gmx.de" - } + "gdt": 75.09000000000002 }, { "id": 6, @@ -194,35 +189,31 @@ Assuming session was valid and gdt server was setup correct "id": 8, "amount": 10, "date": "2021-07-31T13:58:00+00:00", + "email": "tester1@gmail.com", "comment": null, "coupon_code": "", "gdt_entry_type_id": 4, "factor": 15, "amount2": 0, "factor2": 0.05, - "gdt": 7.5, - "publisher": { - "id": 12, - "first_name": "Dario", - "last_name": "Frodo", - "email": "dariofrodo@gmx.de" - } + "gdt": 7.5 } ], "gdtSum": 2220.99, - "timeUsed": 0.19156503677368165 + "timeUsed": 0.012517929077148438 } - `count`: Count of total gdt transactions for user - `gdtEntries`: array with gdt entries, sort by date - `amount`: amount of payed money in euro, expect by gdt_entry_type_id = 7, then it is GDT Sum for Global Modificator time span - `date`: date of transaction with let create gdt transaction, date for picking factor and Global Modificator + - `email`: email of user which has payed money, for gdt_entry_type_id = 4 it is the email of user who was recruited - `comment`: custom comment or Global Modificator name if gdt_entry_type_id = 7 - `gdt_entry_type_id`: type of gdt entry (1) Form: Single GDT Entry directly created by admin via formular (2) CVS: Created by importing a CVS-List with multiple GDT Entries (3) Elopage: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) - (4) Elopage Publisher: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) for publisher, containing publisher object + (4) Elopage Publisher: Automatic created by Elopage Transaction (with revenue > 0 and payment state success) for publisher (5) Digistore: Automatic created by Digistore Transaction (6) CVS2: Created by importing a CVS-List with multiple GDT Entries, other format (used by Bernds old Accounting Tool) (7) Global Modificator: Global Modificator which grand percental bonus on GDT in possession in event time span @@ -230,7 +221,6 @@ Assuming session was valid and gdt server was setup correct - `amount2`: Bonus add amount for gdt, sparly used - `factor2`: Bonus mulitplication factor used by elopage publisher entry - `gdt`: GDT Value, calculatedt from other value: gdt = amount * factor * factor2 + amount2 - - `publisher`: exist only on Elopage Publisher (gdt_entry_type_id = 4) GDT Entries - `gdtSum`: Total GDT Sum of user - `timeUsed`: GDT Server isn't optimized, this is for easy checking if it is still fast enough From c17871f82b44d7fd593a62fcdac9e91ef046d0a3 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 5 Aug 2021 15:40:46 +0200 Subject: [PATCH 08/27] pull dario --- frontend/README.md | 4 +- frontend/src/apis/communityAPI.js | 8 +- .../src/views/Layout/DashboardLayout_gdd.vue | 115 ++++++++---------- .../AccountOverview/GddTransactionGdtList.vue | 46 ++++--- .../Pages/UserProfileTransactionList.vue | 10 +- 5 files changed, 96 insertions(+), 87 deletions(-) diff --git a/frontend/README.md b/frontend/README.md index d94034c15..e9ac0b097 100755 --- a/frontend/README.md +++ b/frontend/README.md @@ -342,7 +342,7 @@ Ein GDT Eintrag sieht so aus: ``` { "id": 8857, - "amount": 1000, // = 10,00 Euro + "amount": 1000, // GDT "date": "2020-06-17T14:12:00+00:00", "email": "foerderkreis-1@gradido.org", "comment": null, @@ -379,8 +379,10 @@ Bis zum 5. (Bernd ist 2.) Diese Beziehung wird durch die connectEntries dargestellt. Insbesondere durch den publishersPath, connect enthält einfach nur alle mögliche Daten. + # TODO TODO: Update GDT-Server um paging und Zugriff auf alle Einträge zu erhalten, optimierter Zugriff GET https://staging.gradido.net/state-balances/ajaxGdtTransactions Liefert wenn alles in Ordnung ist: +wenn nicht type 7 dann "amount" in euro ansonsten in GDT \ No newline at end of file diff --git a/frontend/src/apis/communityAPI.js b/frontend/src/apis/communityAPI.js index 65b9d40b9..ed1d336df 100644 --- a/frontend/src/apis/communityAPI.js +++ b/frontend/src/apis/communityAPI.js @@ -45,10 +45,10 @@ const communityAPI = { `${CONFIG.COMMUNITY_API_URL}state-balances/ajaxGdtOverview/${firstPage}/${items}/${order}/${sessionId}`, ) }, - //http://localhost/vue/public/json-example/admin_transactionGdt_list.json - //http://localhost/state-balances/ajaxGdtOverview - /* create: async (sessionId, email, amount, memo, target_date = new Date() ) => { - const payload = { + /* http://localhost/vue/public/json-example/admin_transactionGdt_list.json + http://localhost/state-balances/ajaxGdtOverview + create: async (sessionId, email, amount, memo, target_date = new Date() ) => { + const payload = { sessionId, email, amount, diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 302fe5039..2b07e3884 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -49,7 +49,6 @@
-
- @@ -75,11 +72,9 @@ import 'perfect-scrollbar/css/perfect-scrollbar.css' import loginAPI from '../../apis/loginAPI' import ContentFooter from './ContentFooter.vue' -// import DashboardContent from './Content.vue'; import { FadeTransition } from 'vue2-transitions' import communityAPI from '../../apis/communityAPI' import VueQrcode from 'vue-qrcode' -//import { gdt } from '../../../public/json-example/admin_transactionGdt_list.json' function hasElement(className) { return document.getElementsByClassName(className).length > 0 @@ -112,7 +107,7 @@ export default { transactionCount: 0, pending: true, transactionsGdt: [], - } + } }, methods: { initScrollbar() { @@ -147,60 +142,59 @@ export default { // what to do when loading balance fails? } }, - async updateGdt(){ - //this.transactionsGdt = gdt - // const result = await communityAPI.transactionsGdt( - // this.$store.state.sessionId - // ) - - this.transactionsGdt = [{"state":"success", "gdt": - [ - { - "id": 8821, - "amount": 1000, - "date": "2020-08-12T14:12:00+00:00", - "email": "foerderkreis-1@gradido.org", - "comment": null, - "coupon_code": "", - "gdt_entry_type_id": 4, - "factor": "20.0000", - "amount2": 0, - "factor2": "0.0500", - "gdt": 1000 - }, - { - "id": 8552, - "amount": 1000, - "date": "2020-06-17T14:12:00+00:00", - "email": "foerderkreis-1@gradido.org", - "comment": null, - "coupon_code": "", - "gdt_entry_type_id": 4, - "factor": "20.0000", - "amount2": 0, - "factor2": "0.0500", - "gdt": 1000 - }, - { - "id": 8317, - "amount": 1000, - "date": "2020-03-16T14:12:00+00:00", - "email": "foerderkreis-1@gradido.org", - "comment": null, - "coupon_code": "", - "gdt_entry_type_id": 4, - "factor": "20.0000", - "amount2": 0, - "factor2": "0.0500", - "gdt": 1000 - } - ], - "transactionGdtExecutingCount": 3000, - "count": 3 -}] + async updateGdt() { + // const result = await communityAPI.transactionsGdt( + // this.$store.state.sessionId + // ) - //console.log("DashboardLayout_gdd.vue") - //console.log(this.result) + this.transactionsGdt = [ + { + state: 'success', + gdt: [ + { + id: 8821, + amount: 1000, + date: '2020-08-12T14:12:00+00:00', + email: 'foerderkreis-1@gradido.org', + comment: null, + coupon_code: '', + gdt_entry_type_id: 4, + factor: '20.0000', + amount2: 0, + factor2: '0.0500', + gdt: 1000, + }, + { + id: 8552, + amount: 1000, + date: '2020-06-17T14:12:00+00:00', + email: 'foerderkreis-1@gradido.org', + comment: null, + coupon_code: '', + gdt_entry_type_id: 4, + factor: '20.0000', + amount2: 0, + factor2: '0.0500', + gdt: 1000, + }, + { + id: 8317, + amount: 1000, + date: '2020-03-16T14:12:00+00:00', + email: 'foerderkreis-1@gradido.org', + comment: null, + coupon_code: '', + gdt_entry_type_id: 4, + factor: '20.0000', + amount2: 0, + factor2: '0.0500', + gdt: 1000, + }, + ], + transactionGdtExecutingCount: 3000, + count: 3, + }, + ] }, updateBalance(ammount) { this.balance -= ammount @@ -209,7 +203,6 @@ export default { mounted() { this.initScrollbar() this.updateGdt() - console.log(this.transactionsGdt) }, } diff --git a/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue b/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue index 775d4b70e..f19db82d3 100644 --- a/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue +++ b/frontend/src/views/Pages/AccountOverview/GddTransactionGdtList.vue @@ -1,26 +1,36 @@ @@ -34,7 +44,7 @@ export default { methods: { updateGdt() { this.$emit('update-gdt') - }, + }, }, } diff --git a/frontend/src/views/Pages/UserProfileTransactionList.vue b/frontend/src/views/Pages/UserProfileTransactionList.vue index 75d296306..20e9bcb93 100644 --- a/frontend/src/views/Pages/UserProfileTransactionList.vue +++ b/frontend/src/views/Pages/UserProfileTransactionList.vue @@ -1,6 +1,6 @@ diff --git a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue index 9d211d22d..9303bd837 100644 --- a/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue +++ b/frontend/src/views/Pages/AccountOverview/GdtTransactionList.vue @@ -17,13 +17,6 @@ } in this.transactionsGdt" :key="id" > -
-
- {{ $t('gdt.gdt-received') }} {{ comment ? ': [' + comment + ']' : '' }} -
- {{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }} -
-
@@ -124,16 +117,6 @@