+
+
+
+
+
+ {{ $t('statistic.count') }}
+ {{ $t('statistic.details') }}
+
+
+
+
+
+ {{ $t('statistic.totalUsers') }}
+
+ {{ value.totalUsers }}
+
+
+
+
+ {{ $t('statistic.activeUsers') }}
+
+ {{ value.activeUsers }}
+
+
+
+
+ {{ $t('statistic.deletedUsers') }}
+
+ {{ value.deletedUsers }}
+
+
+
+
+ {{ $t('statistic.totalGradidoCreated') }}
+
+
+ {{ $n(value.totalGradidoCreated, 'decimal') }} {{ $t('GDD') }}
+
+ {{ value.totalGradidoCreated }}
+
+
+
+ {{ $t('statistic.totalGradidoDecayed') }}
+
+
+ {{ $n(value.totalGradidoDecayed, 'decimal') }} {{ $t('GDD') }}
+
+ {{ value.totalGradidoDecayed }}
+
+
+
+ {{ $t('statistic.totalGradidoAvailable') }}
+
+
+ {{ $n(value.totalGradidoAvailable, 'decimal') }} {{ $t('GDD') }}
+
+ {{ value.totalGradidoAvailable }}
+
+
+
+ {{ $t('statistic.totalGradidoUnbookedDecayed') }}
+
+
+ {{ $n(value.totalGradidoUnbookedDecayed, 'decimal') }} {{ $t('GDD') }}
+
+ {{ value.totalGradidoUnbookedDecayed }}
+
+
+
+
+
+
diff --git a/admin/src/locales/de.json b/admin/src/locales/de.json
index 456290ca7..ad7a668e2 100644
--- a/admin/src/locales/de.json
+++ b/admin/src/locales/de.json
@@ -85,7 +85,6 @@
"hide_details": "Details verbergen",
"lastname": "Nachname",
"math": {
- "colon": ":",
"equals": "=",
"exclaim": "!",
"pipe": "|",
@@ -104,6 +103,7 @@
"my-account": "Mein Konto",
"open_creation": "Offene Schöpfungen",
"overview": "Übersicht",
+ "statistic": "Statistik",
"user_search": "Nutzersuche"
},
"not_open_creations": "Keine offenen Schöpfungen",
@@ -125,8 +125,9 @@
"save": "Speichern",
"statistic": {
"activeUsers": "Aktive Mitglieder",
+ "count": "Menge",
"deletedUsers": "Gelöschte Mitglieder",
- "name": "Statistik",
+ "details": "Details",
"totalGradidoAvailable": "GDD insgesamt im Umlauf",
"totalGradidoCreated": "GDD insgesamt geschöpft",
"totalGradidoDecayed": "GDD insgesamt verfallen",
diff --git a/admin/src/locales/en.json b/admin/src/locales/en.json
index 9bff733c5..3f8751fa1 100644
--- a/admin/src/locales/en.json
+++ b/admin/src/locales/en.json
@@ -85,7 +85,6 @@
"hide_details": "Hide details",
"lastname": "Lastname",
"math": {
- "colon": ":",
"equals": "=",
"exclaim": "!",
"pipe": "|",
@@ -104,6 +103,7 @@
"my-account": "My Account",
"open_creation": "Open creations",
"overview": "Overview",
+ "statistic": "Statistic",
"user_search": "User search"
},
"not_open_creations": "No open creations",
@@ -125,8 +125,9 @@
"save": "Speichern",
"statistic": {
"activeUsers": "Active members",
+ "count": "Count",
"deletedUsers": "Deleted members",
- "name": "Statistic",
+ "details": "Details",
"totalGradidoAvailable": "Total GDD in circulation",
"totalGradidoCreated": "Total created GDD",
"totalGradidoDecayed": "Total GDD decay",
diff --git a/admin/src/pages/CommunityStatistic.spec.js b/admin/src/pages/CommunityStatistic.spec.js
new file mode 100644
index 000000000..50e04d11f
--- /dev/null
+++ b/admin/src/pages/CommunityStatistic.spec.js
@@ -0,0 +1,98 @@
+import { mount } from '@vue/test-utils'
+import CommunityStatistic from './CommunityStatistic.vue'
+import { communityStatistics } from '@/graphql/communityStatistics.js'
+import { toastErrorSpy } from '../../test/testSetup'
+import VueApollo from 'vue-apollo'
+import { createMockClient } from 'mock-apollo-client'
+
+const mockClient = createMockClient()
+const apolloProvider = new VueApollo({
+ defaultClient: mockClient,
+})
+
+const localVue = global.localVue
+localVue.use(VueApollo)
+
+const defaultData = () => {
+ return {
+ communityStatistics: {
+ totalUsers: 3113,
+ activeUsers: 1057,
+ deletedUsers: 35,
+ totalGradidoCreated: '4083774.05000000000000000000',
+ totalGradidoDecayed: '-1062639.13634129622923372197',
+ totalGradidoAvailable: '2513565.869444365732411569',
+ totalGradidoUnbookedDecayed: '-500474.6738366222166261272',
+ },
+ }
+}
+
+const mocks = {
+ $t: jest.fn((t) => t),
+ $n: jest.fn((n) => n),
+}
+
+describe('CommunityStatistic', () => {
+ let wrapper
+
+ const communityStatisticsMock = jest.fn()
+
+ mockClient.setRequestHandler(
+ communityStatistics,
+ communityStatisticsMock
+ .mockRejectedValueOnce({ message: 'Ouch!' })
+ .mockResolvedValue({ data: defaultData() }),
+ )
+
+ const Wrapper = () => {
+ return mount(CommunityStatistic, { localVue, mocks, apolloProvider })
+ }
+
+ describe('mount', () => {
+ beforeEach(() => {
+ wrapper = Wrapper()
+ })
+
+ it('renders the Div Element ".community-statistic"', () => {
+ expect(wrapper.find('div.community-statistic').exists()).toBe(true)
+ })
+
+ describe('server response for get statistics is an error', () => {
+ it('toast an error message', () => {
+ expect(toastErrorSpy).toBeCalledWith('Ouch!')
+ })
+ })
+
+ describe('server response for getting statistics is success', () => {
+ it('renders the data correctly', () => {
+ expect(wrapper.findAll('tr').at(1).findAll('td').at(1).text()).toEqual('3113')
+ expect(wrapper.findAll('tr').at(2).findAll('td').at(1).text()).toEqual('1057')
+ expect(wrapper.findAll('tr').at(3).findAll('td').at(1).text()).toEqual('35')
+ expect(wrapper.findAll('tr').at(4).findAll('td').at(1).text()).toEqual(
+ '4083774.05000000000000000000 GDD',
+ )
+ expect(wrapper.findAll('tr').at(4).findAll('td').at(2).text()).toEqual(
+ '4083774.05000000000000000000',
+ )
+ expect(wrapper.findAll('tr').at(5).findAll('td').at(1).text()).toEqual(
+ '-1062639.13634129622923372197 GDD',
+ )
+ expect(wrapper.findAll('tr').at(5).findAll('td').at(2).text()).toEqual(
+ '-1062639.13634129622923372197',
+ )
+ expect(wrapper.findAll('tr').at(6).findAll('td').at(1).text()).toEqual(
+ '2513565.869444365732411569 GDD',
+ )
+ expect(wrapper.findAll('tr').at(6).findAll('td').at(2).text()).toEqual(
+ '2513565.869444365732411569',
+ )
+ expect(wrapper.findAll('tr').at(7).findAll('td').at(1).text()).toEqual(
+ '-500474.6738366222166261272 GDD',
+ )
+ expect(wrapper.findAll('tr').at(7).findAll('td').at(2).text()).toEqual(
+ '-500474.6738366222166261272',
+ )
+ })
+ })
+ })
+})
diff --git a/admin/src/pages/CommunityStatistic.vue b/admin/src/pages/CommunityStatistic.vue
new file mode 100644
index 000000000..3b4865ee3
--- /dev/null
+++ b/admin/src/pages/CommunityStatistic.vue
@@ -0,0 +1,42 @@
+