From 20ee334febe87b25c1f76c3cd137e6abb93d63f6 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Feb 2023 12:41:59 +0100 Subject: [PATCH 1/5] fix(frontend): community link --- frontend/src/pages/InfoStatistic.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/InfoStatistic.vue b/frontend/src/pages/InfoStatistic.vue index b27166dc1..1bfb53d4a 100644 --- a/frontend/src/pages/InfoStatistic.vue +++ b/frontend/src/pages/InfoStatistic.vue @@ -6,9 +6,9 @@ {{ CONFIG.COMMUNITY_DESCRIPTION }}
- + {{ CONFIG.COMMUNITY_URL }} - +

{{ $t('community.openContributionLinks') }}
From 64930cfb3f2f2a8bc1e1618f9f72c9b9746b97df Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Feb 2023 12:58:30 +0100 Subject: [PATCH 2/5] fix(frontend): fix is last month for empty form date --- frontend/src/pages/Community.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 113bcd4e4..71fb9f552 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -188,6 +188,7 @@ export default { return new Date(date.setMonth(date.getMonth() - 1, 1)) }, isThisMonth() { + if (!this.form.date) return false const formDate = new Date(this.form.date) return ( formDate.getFullYear() === this.maximalDate.getFullYear() && From 2e18ca41c9b008198a70c0b23c90b299380becd6 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Feb 2023 13:33:38 +0100 Subject: [PATCH 3/5] get it working --- .../components/Contributions/ContributionForm.vue | 14 ++++++++++---- frontend/src/pages/Community.vue | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 9a2ffb54b..3b631f63e 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -23,10 +23,7 @@ -
+
{{ noOpenCreation }}
@@ -135,6 +132,15 @@ export default { }, }, computed: { + showMessage() { + if (this.maxGddThisMonth <= 0 && this.maxGddLastMonth <= 0) return true + if (this.form.date) + return ( + (this.isThisMonth && this.maxGddThisMonth <= 0) || + (!this.isThisMonth && this.maxGddLastMonth <= 0) + ) + return false + }, disabled() { return ( this.form.date === '' || diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue index 71fb9f552..113bcd4e4 100644 --- a/frontend/src/pages/Community.vue +++ b/frontend/src/pages/Community.vue @@ -188,7 +188,6 @@ export default { return new Date(date.setMonth(date.getMonth() - 1, 1)) }, isThisMonth() { - if (!this.form.date) return false const formDate = new Date(this.form.date) return ( formDate.getFullYear() === this.maximalDate.getFullYear() && From 04fd66dbc4f3b3b9a84fdbc7bfc00cf7129aac03 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Feb 2023 14:16:55 +0100 Subject: [PATCH 4/5] test to 100% --- .../Contributions/ContributionForm.spec.js | 332 ++++++++---------- .../Contributions/ContributionForm.vue | 6 +- 2 files changed, 152 insertions(+), 186 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 020e3f552..71ead88b9 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -24,11 +24,6 @@ describe('ContributionForm', () => { $t: jest.fn((t) => t), $d: jest.fn((d) => d), $n: jest.fn((n) => n), - $store: { - state: { - creation: ['1000', '1000', '1000'], - }, - }, $i18n: { locale: 'en', }, @@ -61,7 +56,7 @@ describe('ContributionForm', () => { }) }) - describe('dates', () => { + describe('dates and max amounts', () => { beforeEach(async () => { await wrapper.setData({ form: { @@ -73,204 +68,176 @@ describe('ContributionForm', () => { }) }) - describe('actual date', () => { - describe('same month', () => { - beforeEach(async () => { - const now = new Date().toISOString() - await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) + describe('max amount reached for both months', () => { + beforeEach(() => { + wrapper.setProps({ + maxGddLastMonth: 0, + maxGddThisMonth: 0, }) - - describe('isThisMonth', () => { - it('has true', () => { - expect(wrapper.vm.isThisMonth).toBe(true) - }) + wrapper.setData({ + form: { + id: null, + date: 'set', + memo: '', + amount: '', + }, }) }) - describe.skip('month before', () => { - beforeEach(async () => { - await wrapper - .findComponent({ name: 'BFormDatepicker' }) - .vm.$emit('input', wrapper.vm.minimalDate) - }) - - describe('isThisMonth', () => { - it('has false', () => { - expect(wrapper.vm.isThisMonth).toBe(false) - }) - }) + it('shows message that no contributions are available', () => { + expect(wrapper.find('[data-test="contribtion-message"]').text()).toBe( + 'contribution.noOpenCreation.allMonth', + ) }) }) - describe.skip('date in middle of year', () => { - describe('same month', () => { - beforeEach(async () => { - // jest.useFakeTimers('modern') - // jest.setSystemTime(new Date('2020-07-06')) - // await wrapper.findComponent({ name: 'BFormDatepicker' }).vm.$emit('input', now) - await wrapper.setData({ - maximalDate: new Date(2020, 6, 6), - form: { date: new Date(2020, 6, 6) }, - }) - }) - - describe('minimalDate', () => { - it('has "2020-06-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2020-06-01T00:00:00.000Z') - }) - }) - - describe('isThisMonth', () => { - it('has true', () => { - expect(wrapper.vm.isThisMonth).toBe(true) - }) + describe('max amount reached for last month, no date selected', () => { + beforeEach(() => { + wrapper.setProps({ + maxGddLastMonth: 0, }) }) - describe('month before', () => { - beforeEach(async () => { - // jest.useFakeTimers('modern') - // jest.setSystemTime(new Date('2020-07-06')) - // console.log('middle of year date – now:', wrapper.vm.minimalDate) - // await wrapper - // .findComponent({ name: 'BFormDatepicker' }) - // .vm.$emit('input', wrapper.vm.minimalDate) - await wrapper.setData({ - maximalDate: new Date(2020, 6, 6), - form: { date: new Date(2020, 5, 6) }, - }) - }) - - describe('minimalDate', () => { - it('has "2020-06-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2020-06-01T00:00:00.000Z') - }) - }) - - describe('isThisMonth', () => { - it('has false', () => { - expect(wrapper.vm.isThisMonth).toBe(false) - }) - }) + it('shows no message', () => { + expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false) }) }) - describe.skip('date in january', () => { - describe('same month', () => { - beforeEach(async () => { - await wrapper.setData({ - maximalDate: new Date(2020, 0, 6), - form: { date: new Date(2020, 0, 6) }, - }) + describe('max amount reached for last month, last month selected', () => { + beforeEach(async () => { + wrapper.setProps({ + maxGddLastMonth: 0, + isThisMonth: false, }) - - describe('minimalDate', () => { - it('has "2019-12-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2019-12-01T00:00:00.000Z') - }) - }) - - describe('isThisMonth', () => { - it('has true', () => { - expect(wrapper.vm.isThisMonth).toBe(true) - }) + await wrapper.setData({ + form: { + id: null, + date: 'set', + memo: '', + amount: '', + }, }) }) - describe('month before', () => { - beforeEach(async () => { - // jest.useFakeTimers('modern') - // jest.setSystemTime(new Date('2020-07-06')) - // console.log('middle of year date – now:', wrapper.vm.minimalDate) - // await wrapper - // .findComponent({ name: 'BFormDatepicker' }) - // .vm.$emit('input', wrapper.vm.minimalDate) - await wrapper.setData({ - maximalDate: new Date(2020, 0, 6), - form: { date: new Date(2019, 11, 6) }, - }) - }) - - describe('minimalDate', () => { - it('has "2019-12-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2019-12-01T00:00:00.000Z') - }) - }) - - describe('isThisMonth', () => { - it('has false', () => { - expect(wrapper.vm.isThisMonth).toBe(false) - }) - }) + it('shows message that no contributions are available for last month', () => { + expect(wrapper.find('[data-test="contribtion-message"]').text()).toBe( + 'contribution.noOpenCreation.lastMonth', + ) }) }) - describe.skip('date with the 31st day of the month', () => { - describe('same month', () => { - beforeEach(async () => { - await wrapper.setData({ - maximalDate: new Date('2022-10-31T00:00:00.000Z'), - form: { date: new Date('2022-10-31T00:00:00.000Z') }, - }) + describe('max amount reached for last month, this month selected', () => { + beforeEach(async () => { + wrapper.setProps({ + maxGddLastMonth: 0, + isThisMonth: true, }) + await wrapper.setData({ + form: { + id: null, + date: 'set', + memo: '', + amount: '', + }, + }) + }) - describe('minimalDate', () => { - it('has "2022-09-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2022-09-01T00:00:00.000Z') - }) - }) - - describe('isThisMonth', () => { - it('has true', () => { - expect(wrapper.vm.isThisMonth).toBe(true) - }) - }) + it('shows no message', () => { + expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false) }) }) - describe.skip('date with the 28th day of the month', () => { - describe('same month', () => { - beforeEach(async () => { - await wrapper.setData({ - maximalDate: new Date('2023-02-28T00:00:00.000Z'), - form: { date: new Date('2023-02-28T00:00:00.000Z') }, - }) + describe('max amount reached for this month, no date selected', () => { + beforeEach(() => { + wrapper.setProps({ + maxGddThisMonth: 0, }) + }) - describe('minimalDate', () => { - it('has "2023-01-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2023-01-01T00:00:00.000Z') - }) - }) - - describe('isThisMonth', () => { - it('has true', () => { - expect(wrapper.vm.isThisMonth).toBe(true) - }) - }) + it('shows no message', () => { + expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false) }) }) - describe.skip('date with 29.02.2024 leap year', () => { - describe('same month', () => { - beforeEach(async () => { - await wrapper.setData({ - maximalDate: new Date('2024-02-29T00:00:00.000Z'), - form: { date: new Date('2024-02-29T00:00:00.000Z') }, - }) + describe('max amount reached for this month, this month selected', () => { + beforeEach(async () => { + wrapper.setProps({ + maxGddThisMonth: 0, + isThisMonth: true, }) + await wrapper.setData({ + form: { + id: null, + date: 'set', + memo: '', + amount: '', + }, + }) + }) - describe('minimalDate', () => { - it('has "2024-01-01T00:00:00.000Z"', () => { - expect(wrapper.vm.minimalDate.toISOString()).toBe('2024-01-01T00:00:00.000Z') - }) - }) + it('shows message that no contributions are available for last month', () => { + expect(wrapper.find('[data-test="contribtion-message"]').text()).toBe( + 'contribution.noOpenCreation.thisMonth', + ) + }) + }) - describe('isThisMonth', () => { - it('has true', () => { - expect(wrapper.vm.isThisMonth).toBe(true) - }) + describe('max amount reached for this month, last month selected', () => { + beforeEach(async () => { + wrapper.setProps({ + maxGddThisMonth: 0, + isThisMonth: false, }) + await wrapper.setData({ + form: { + id: null, + date: 'set', + memo: '', + amount: '', + }, + }) + }) + + it('shows no message', () => { + expect(wrapper.find('[data-test="contribtion-message"]').exists()).toBe(false) + }) + }) + }) + + describe('default return message', () => { + it('returns an empty string', () => { + expect(wrapper.vm.noOpenCreation).toBe('') + }) + }) + + describe('update amount', () => { + beforeEach(() => { + wrapper.findComponent({ name: 'InputHour' }).vm.$emit('updateAmount', 20) + }) + + it('updates form amount', () => { + expect(wrapper.vm.form.amount).toBe('400.00') + }) + }) + + describe('watch value', () => { + beforeEach(() => { + wrapper.setProps({ + value: { + id: 42, + date: 'set', + memo: 'Some Memo', + amount: '400.00', + }, + }) + }) + + it('updates form', () => { + expect(wrapper.vm.form).toEqual({ + id: 42, + date: 'set', + memo: 'Some Memo', + amount: '400.00', }) }) }) @@ -477,24 +444,23 @@ describe('ContributionForm', () => { }) }) - describe.skip('on trigger submit', () => { + describe('on trigger submit', () => { beforeEach(async () => { await wrapper.find('form').trigger('submit') }) it('emits "update-contribution"', () => { - expect(wrapper.emitted('update-contribution')).toEqual( - expect.arrayContaining([ - expect.arrayContaining([ - { - id: 2, - date: now, - memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', - amount: '200', - }, - ]), - ]), - ) + expect(wrapper.emitted('update-contribution')).toEqual([ + [ + { + id: 2, + date: now, + hours: 0, + memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', + amount: '200', + }, + ], + ]) }) }) }) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 3b631f63e..0d512ab63 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -23,7 +23,7 @@ -
+
{{ noOpenCreation }}
@@ -115,8 +115,8 @@ export default { } }, methods: { - updateAmount(amount) { - this.form.amount = (amount * 20).toFixed(2).toString() + updateAmount(hours) { + this.form.amount = (hours * 20).toFixed(2).toString() }, submit() { this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) From 05f9917ac773f58fb88ce93e931cedf0c216b630 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 10 Feb 2023 14:42:16 +0100 Subject: [PATCH 5/5] feat(release): Version 1.18.1 --- CHANGELOG.md | 8 ++++++++ admin/package.json | 2 +- backend/package.json | 2 +- database/package.json | 2 +- frontend/package.json | 2 +- package.json | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 706caed8a..366339834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.18.1](https://github.com/gradido/gradido/compare/1.18.0...1.18.1) + +- fix(frontend): fix is last month for empty form date [`#2697`](https://github.com/gradido/gradido/pull/2697) +- fix(frontend): community link [`#2696`](https://github.com/gradido/gradido/pull/2696) + #### [1.18.0](https://github.com/gradido/gradido/compare/1.17.1...1.18.0) +> 9 February 2023 + +- feat(release): version 1.18.0 [`#2690`](https://github.com/gradido/gradido/pull/2690) - refactor(frontend): toast by automatically logged out [`#2681`](https://github.com/gradido/gradido/pull/2681) - refactor(frontend): change text for gdd_per_link.choose-amount [`#2638`](https://github.com/gradido/gradido/pull/2638) - fix(backend): emails for deny and delete contribution [`#2688`](https://github.com/gradido/gradido/pull/2688) diff --git a/admin/package.json b/admin/package.json index c8cccefd5..e443e7f9e 100644 --- a/admin/package.json +++ b/admin/package.json @@ -3,7 +3,7 @@ "description": "Administraion Interface for Gradido", "main": "index.js", "author": "Moriz Wahl", - "version": "1.18.0", + "version": "1.18.1", "license": "Apache-2.0", "private": false, "scripts": { diff --git a/backend/package.json b/backend/package.json index f58a1ddd3..5357a7217 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "gradido-backend", - "version": "1.18.0", + "version": "1.18.1", "description": "Gradido unified backend providing an API-Service for Gradido Transactions", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/backend", diff --git a/database/package.json b/database/package.json index 28790eae8..7fad11216 100644 --- a/database/package.json +++ b/database/package.json @@ -1,6 +1,6 @@ { "name": "gradido-database", - "version": "1.18.0", + "version": "1.18.1", "description": "Gradido Database Tool to execute database migrations", "main": "src/index.ts", "repository": "https://github.com/gradido/gradido/database", diff --git a/frontend/package.json b/frontend/package.json index 041b5a8e2..64fde2b19 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bootstrap-vue-gradido-wallet", - "version": "1.18.0", + "version": "1.18.1", "private": true, "scripts": { "start": "node run/server.js", diff --git a/package.json b/package.json index 3728e6283..2cb1b5dc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gradido", - "version": "1.18.0", + "version": "1.18.1", "description": "Gradido", "main": "index.js", "repository": "git@github.com:gradido/gradido.git",