diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9f4083a3..2992f451b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -265,10 +265,10 @@ jobs: - name: backend login | Coverage check uses: webcraftmedia/coverage-check-action@master with: - report_name: Coverage Backend + report_name: Coverage Backend Login type: lcov result_path: ./coverage/coverage.info - min_coverage: 6 + min_coverage: 13 token: ${{ github.token }} ############################################################################## @@ -335,14 +335,14 @@ jobs: ######################################################################### # COVERAGE CHECK BACKEND COMMUNITY-SERVER #################################### ########################################################################## - #- name: backend community simplecov | Coverage check - # uses: webcraftmedia/coverage-check-action@master - # with: - # report_name: Coverage Backend - # type: simplecov - # result_path: ./coverage/coverage.info - # min_coverage: 8 - # token: ${{ github.token }} + - name: backend community | Coverage check + uses: einhornimmond/coverage-check-action@master + with: + report_name: Coverage Backend Community + type: phpunit + result_path: ./coverage/coverage.info + min_coverage: 10 + token: ${{ github.token }} #test: # runs-on: ubuntu-latest diff --git a/community_server/Dockerfile b/community_server/Dockerfile index eabb37741..c553137c6 100644 --- a/community_server/Dockerfile +++ b/community_server/Dockerfile @@ -21,9 +21,10 @@ RUN apt-get update \ && apt-get -y --no-install-recommends install php7.4-xdebug \ && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* -WORKDIR /var/www/cakephp + ENV XDEBUG_MODE=coverage +#RUN composer require --dev rregeer/phpunit-coverage-check -CMD ./vendor/bin/phpunit --coverage-text=./webroot/coverage/coverage.info - +#CMD ./vendor/bin/phpunit --coverage-clover=./webroot/coverage/clover.xml +CMD ./vendor/bin/phpunit --coverage-text=./webroot/coverage/coverage.info diff --git a/community_server/src/Controller/AppRequestsController.php b/community_server/src/Controller/AppRequestsController.php index 6b744ff69..ff3314e94 100644 --- a/community_server/src/Controller/AppRequestsController.php +++ b/community_server/src/Controller/AppRequestsController.php @@ -152,10 +152,7 @@ class AppRequestsController extends AppController if($result !== true) { return $this->returnJson($result); } - $required_fields = $this->checkAndCopyRequiredFields(['target_date'], $params, $data); - if($required_fields !== true) { - return $this->returnJson($required_fields); - } + if(!isset($params['memo']) || strlen($params['memo']) < 5 || strlen($params['memo']) > 150) { return $this->returnJson(['state' => 'error', 'msg' => 'memo is not set or not in expected range [5;150]']); } diff --git a/community_server/src/Model/Table/TransactionsTable.php b/community_server/src/Model/Table/TransactionsTable.php index c4bc4b698..7e59c2d88 100644 --- a/community_server/src/Model/Table/TransactionsTable.php +++ b/community_server/src/Model/Table/TransactionsTable.php @@ -178,24 +178,20 @@ class TransactionsTable extends Table } if($prev && $decay == true) { - if($prev->balance > 0) { - // var_dump($stateUserTransactions); $current = $su_transaction; - //echo "decay between " . $prev->transaction_id . " and " . $current->transaction_id . "
"; + $calculated_decay = $stateBalancesTable->calculateDecay($prev->balance, $prev->balance_date, $current->balance_date, true); - $balance = floatval($prev->balance - $calculated_decay['balance']); - // skip small decays (smaller than 0,00 GDD) + $balance = floatval($prev->balance - $calculated_decay['balance']); - if(abs($balance) >= 100) { - //echo $interval->format('%R%a days'); - //echo "prev balance: " . $prev->balance . ", diff_amount: $diff_amount, summe: " . (-intval($prev->balance - $diff_amount)) . "
"; - $final_transactions[] = [ - 'type' => 'decay', - 'balance' => $balance, - 'decay_duration' => $calculated_decay['interval']->format('%a days, %H hours, %I minutes, %S seconds'), - 'memo' => '' - ]; + if($balance) + { + $final_transactions[] = [ + 'type' => 'decay', + 'balance' => $balance, + 'decay_duration' => $calculated_decay['interval']->format('%a days, %H hours, %I minutes, %S seconds'), + 'memo' => '' + ]; } } } @@ -207,9 +203,7 @@ class TransactionsTable extends Table // date // balance $transaction = $transaction_indiced[$su_transaction->transaction_id]; - /*echo "transaction:
"; - var_dump($transaction); - echo "
";*/ + if($su_transaction->transaction_type_id == 1) { // creation $creation = $transaction->transaction_creation; $balance = $stateBalancesTable->calculateDecay($creation->amount, $creation->target_date, $transaction->received); @@ -270,14 +264,16 @@ class TransactionsTable extends Table $duration = $decay_start_date->timeAgoInWords(); } $balance = floatval($su_transaction->balance - $calculated_decay['balance']); - if($balance > 100) { - $final_transactions[] = [ - 'type' => 'decay', - 'balance' => $balance, - 'decay_duration' => $duration, - 'last_decay' => true, - 'memo' => '' - ]; + + if($balance) + { + $final_transactions[] = [ + 'type' => 'decay', + 'balance' => $balance, + 'decay_duration' => $duration, + 'last_decay' => true, + 'memo' => '' + ]; } } } diff --git a/frontend/package.json b/frontend/package.json index 34ce37b76..910644e2c 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -51,6 +51,7 @@ "nouislider": "^12.1.0", "particles-bg-vue": "1.2.3", "perfect-scrollbar": "^1.3.0", + "portal-vue": "^2.1.7", "prettier": "^2.2.1", "qrcode": "^1.4.4", "quill": "^1.3.6", @@ -58,6 +59,7 @@ "sweetalert2": "^9.5.4", "vee-validate": "^3.4.5", "vue": "^2.6.11", + "vue-bootstrap-toasts": "^1.0.7", "vue-bootstrap-typeahead": "^0.2.6", "vue-chartjs": "^3.5.0", "vue-cli-plugin-i18n": "^1.0.1", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index a6613bec1..500a7b2e1 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -3,6 +3,7 @@
+
diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 91e92a2cc..3453bd296 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -98,7 +98,6 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, - changePassword: async (sessionId, email, password) => { const payload = { session_id: sessionId, @@ -120,12 +119,12 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, - changeUsernameProfile: async (sessionId, email, usernameNew) => { + changeUsernameProfile: async (sessionId, email, username) => { const payload = { session_id: sessionId, email, update: { - 'User.usernameNew': usernameNew, + 'User.username': username, }, } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) diff --git a/frontend/src/assets/scss/argon.scss b/frontend/src/assets/scss/argon.scss index 01a002691..1fa663a5f 100644 --- a/frontend/src/assets/scss/argon.scss +++ b/frontend/src/assets/scss/argon.scss @@ -23,38 +23,95 @@ // Bootstrap (4.1.3) components -@import "~bootstrap/scss/root"; -@import "~bootstrap/scss/reboot"; -@import "~bootstrap/scss/type"; -@import "~bootstrap/scss/images"; -@import "~bootstrap/scss/code"; -@import "~bootstrap/scss/grid"; -@import "~bootstrap/scss/tables"; -@import "~bootstrap/scss/forms"; -@import "~bootstrap/scss/buttons"; -@import "~bootstrap/scss/transitions"; -@import "~bootstrap/scss/dropdown"; +@import "~bootstrap/scss/alert"; +@import "~bootstrap/scss/badge"; +@import "~bootstrap/scss/breadcrumb"; @import "~bootstrap/scss/button-group"; -@import "~bootstrap/scss/input-group"; +@import "~bootstrap/scss/buttons"; +@import "~bootstrap/scss/card"; +@import "~bootstrap/scss/carousel"; +@import "~bootstrap/scss/close"; +@import "~bootstrap/scss/code"; @import "~bootstrap/scss/custom-forms"; +@import "~bootstrap/scss/dropdown"; +@import "~bootstrap/scss/forms"; +@import "~bootstrap/scss/grid"; +@import "~bootstrap/scss/images"; +@import "~bootstrap/scss/input-group"; +@import "~bootstrap/scss/jumbotron"; +@import "~bootstrap/scss/list-group"; +@import "~bootstrap/scss/media"; +@import "~bootstrap/scss/modal"; @import "~bootstrap/scss/nav"; @import "~bootstrap/scss/navbar"; -@import "~bootstrap/scss/card"; -@import "~bootstrap/scss/breadcrumb"; @import "~bootstrap/scss/pagination"; -@import "~bootstrap/scss/badge"; -@import "~bootstrap/scss/jumbotron"; -@import "~bootstrap/scss/alert"; -@import "~bootstrap/scss/progress"; -@import "~bootstrap/scss/media"; -@import "~bootstrap/scss/list-group"; -@import "~bootstrap/scss/close"; -@import "~bootstrap/scss/modal"; -@import "~bootstrap/scss/tooltip"; @import "~bootstrap/scss/popover"; -@import "~bootstrap/scss/carousel"; -@import "~bootstrap/scss/utilities"; @import "~bootstrap/scss/print"; +@import "~bootstrap/scss/progress"; +@import "~bootstrap/scss/reboot"; +@import "~bootstrap/scss/root"; +@import "~bootstrap/scss/tables"; +@import "~bootstrap/scss/toasts"; +@import "~bootstrap/scss/tooltip"; +@import "~bootstrap/scss/transitions"; +@import "~bootstrap/scss/type"; +@import "~bootstrap/scss/utilities"; +@import "~bootstrap/scss/variables"; + +// Utilities + +@import "~bootstrap/scss/utilities/align"; +@import "~bootstrap/scss/utilities/background"; +@import "~bootstrap/scss/utilities/borders"; +@import "~bootstrap/scss/utilities/clearfix"; +@import "~bootstrap/scss/utilities/display"; +@import "~bootstrap/scss/utilities/embed"; +@import "~bootstrap/scss/utilities/flex"; +@import "~bootstrap/scss/utilities/float"; +@import "~bootstrap/scss/utilities/overflow"; +@import "~bootstrap/scss/utilities/position"; +@import "~bootstrap/scss/utilities/screenreaders"; +@import "~bootstrap/scss/utilities/shadows"; +@import "~bootstrap/scss/utilities/sizing"; +@import "~bootstrap/scss/utilities/spacing"; +@import "~bootstrap/scss/utilities/stretched-link"; +@import "~bootstrap/scss/utilities/text"; +@import "~bootstrap/scss/utilities/visibility"; + + +// Mixins + +@import "~bootstrap/scss/mixins/alert"; +@import "~bootstrap/scss/mixins/badge"; +@import "~bootstrap/scss/mixins/border-radius"; +@import "~bootstrap/scss/mixins/box-shadow"; +@import "~bootstrap/scss/mixins/breakpoints"; +@import "~bootstrap/scss/mixins/buttons"; +@import "~bootstrap/scss/mixins/caret"; +@import "~bootstrap/scss/mixins/clearfix"; +@import "~bootstrap/scss/mixins/deprecate"; +@import "~bootstrap/scss/mixins/float"; +@import "~bootstrap/scss/mixins/forms"; +@import "~bootstrap/scss/mixins/gradients"; +@import "~bootstrap/scss/mixins/grid-framework"; +@import "~bootstrap/scss/mixins/grid"; +@import "~bootstrap/scss/mixins/hover"; +@import "~bootstrap/scss/mixins/image"; +@import "~bootstrap/scss/mixins/list-group"; +@import "~bootstrap/scss/mixins/lists"; +@import "~bootstrap/scss/mixins/nav-divider"; +@import "~bootstrap/scss/mixins/pagination"; +@import "~bootstrap/scss/mixins/reset-text"; +@import "~bootstrap/scss/mixins/resize"; +@import "~bootstrap/scss/mixins/screen-reader"; +@import "~bootstrap/scss/mixins/size"; +@import "~bootstrap/scss/mixins/table-row"; +@import "~bootstrap/scss/mixins/text-emphasis"; +@import "~bootstrap/scss/mixins/text-hide"; +@import "~bootstrap/scss/mixins/text-truncate"; +@import "~bootstrap/scss/mixins/transition"; +@import "~bootstrap/scss/mixins/visibility"; + // Argon utilities and components diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json index 0fcda6c30..6536a143b 100644 --- a/frontend/src/locales/de.json +++ b/frontend/src/locales/de.json @@ -108,7 +108,10 @@ "activity": { "new":"Neue Gemeinschaftsstunden eintragen", "list":"Meine Gemeinschaftsstunden Liste" - } + }, + "user-data": { + "change-success": "Deine Daten wurden gespeichert." + } }, "navbar" : { "my-profil":"Mein Profil", diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 1ea67c41d..f611e4b91 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -109,7 +109,10 @@ "activity": { "new":"Register new community hours", "list":"My Community Hours List" - } + }, + "user-data": { + "change-success": "Your data has been saved." + } }, "navbar" : { "my-profil":"My profile", diff --git a/frontend/src/main.js b/frontend/src/main.js index 20c8ffcb8..160ff73c7 100755 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -54,10 +54,14 @@ extend('max', { extend('gddSendAmount', { validate(value, { min, max }) { value = value.replace(',', '.') - return value.match(/^[0-9]+(\.[0-9]{1,2})?$/) && Number(value) >= min && Number(value) <= max + return value.match(/^[0-9]+(\.[0-9]{0,2})?$/) && Number(value) >= min && Number(value) <= max }, params: ['min', 'max'], - message: (_, values) => i18n.t('form.validation.gddSendAmount', values), + message: (_, values) => { + values.min = i18n.n(values.min) + values.max = i18n.n(values.max) + return i18n.t('form.validation.gddSendAmount', values) + }, }) // eslint-disable-next-line camelcase diff --git a/frontend/src/plugins/dashboard-plugin.js b/frontend/src/plugins/dashboard-plugin.js index 3cb1cd862..2edac0995 100755 --- a/frontend/src/plugins/dashboard-plugin.js +++ b/frontend/src/plugins/dashboard-plugin.js @@ -4,6 +4,14 @@ import GlobalComponents from './globalComponents' import GlobalDirectives from './globalDirectives' import SideBar from '@/components/SidebarPlugin' +import PortalVue from 'portal-vue' + +import VueBootstrapToasts from 'vue-bootstrap-toasts' + +// vue-bootstrap +import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' + +// asset imports import '@/assets/scss/argon.scss' import '@/assets/vendor/nucleo/css/nucleo.css' import * as rules from 'vee-validate/dist/rules' @@ -20,8 +28,6 @@ import VueMoment from 'vue-moment' import Loading from 'vue-loading-overlay' import 'vue-loading-overlay/dist/vue-loading.css' -import { BootstrapVue, IconsPlugin } from 'bootstrap-vue' - Object.keys(rules).forEach((rule) => { extend(rule, { ...rules[rule], // copies rule configuration @@ -34,8 +40,10 @@ export default { Vue.use(GlobalComponents) Vue.use(GlobalDirectives) Vue.use(SideBar) + Vue.use(PortalVue) Vue.use(BootstrapVue) Vue.use(IconsPlugin) + Vue.use(VueBootstrapToasts) Vue.use(VueMoment) Vue.use(VueQrcodeReader) Vue.use(VueQrcode) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 68f3db88e..6adfe83b9 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -2,6 +2,7 @@