1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(feat) updated FabAnalytics reports to include new features

This commit is contained in:
Sylvain 2022-12-01 16:34:14 +01:00
parent 7b30086a34
commit 575c7c7d62
4 changed files with 35 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# Changelog Fab-manager
- Updated FabAnalytics reports to include new features
- Fix a bug: setting somes decimal amounts (e.g. 4,85) result in another amount (e.g. 4,84)
- Fix a bug: unable to export statistics
- Fix a bug: soft destroyed machines and spaces are still reported in the OpenAPI

View File

@ -9,11 +9,20 @@
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.version' }}</td><td>{{ data.version }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.members' }}</td><td>{{ data.members }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.admins' }}</td><td>{{ data.admins }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.managers' }}</td><td>{{ data.managers }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.availabilities' }}</td><td>{{ data.availabilities }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.reservations' }}</td><td>{{ data.reservations }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.orders' }}</td><td>{{ data.orders }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.plans' }}</td><td>{{ data.plans }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.spaces' }}</td><td>{{ data.spaces }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.online_payment' }}</td><td>{{ data.online_payment }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.gateway' }}</td><td>{{ data.gateway }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.wallet' }}</td><td>{{ data.wallet }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.statistics' }}</td><td>{{ data.statistics }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.trainings' }}</td><td>{{ data.trainings }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.public_agenda' }}</td><td>{{ data.public_agenda }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.machines' }}</td><td>{{ data.machines }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.store' }}</td><td>{{ data.store }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.invoices' }}</td><td>{{ data.invoices }}</td></tr>
<tr><td translate>{{ 'app.admin.settings.privacy.analytics.openlab' }}</td><td>{{ data.openlab }}</td></tr>
</tbody>

View File

@ -12,7 +12,7 @@ class HealthService
end
def self.redis?
!!Sidekiq.redis(&:info) # rubocop:disable Style/DoubleNegation
!!Sidekiq.redis(&:info)
rescue Redis::CannotConnectError
false
end
@ -22,10 +22,8 @@ class HealthService
client = Elasticsearch::Client.new host: "http://#{Rails.application.secrets.elaticsearch_host}:9200"
response = client.perform_request 'GET', '_cluster/health'
!!response.body # rubocop:disable Style/DoubleNegation
rescue Elasticsearch::Transport::Transport::Error
false
rescue Faraday::ConnectionFailed
!!response.body
rescue Elasticsearch::Transport::Transport::Error, Faraday::ConnectionFailed
false
end
@ -39,11 +37,20 @@ class HealthService
version: Version.current,
members: User.members.count,
admins: User.admins.count,
managers: User.managers.count,
availabilities: last_week_availabilities,
reservations: last_week_new_reservations,
orders: last_week_orders,
plans: Setting.get('plans_module'),
spaces: Setting.get('spaces_module'),
online_payment: Setting.get('online_payment_module'),
gateway: Setting.get('payment_gateway'),
wallet: Setting.get('wallet_module'),
statistics: Setting.get('statistics_module'),
trainings: Setting.get('trainings_module'),
public_agenda: Setting.get('public_agenda_module'),
machines: Setting.get('machines_module'),
store: Setting.get('store_module'),
invoices: Setting.get('invoicing_module'),
openlab: Setting.get('openlab_app_secret').present?
}
@ -74,5 +81,8 @@ class HealthService
def self.last_week_new_reservations
Reservation.where('created_at >= ? AND created_at < ?', DateTime.current - 7.days, DateTime.current).count
end
end
def self.last_week_orders
Order.where('created_at >= ? AND created_at < ?', DateTime.current - 7.days, DateTime.current).where.not(state: 'cart').count
end
end

View File

@ -1653,11 +1653,20 @@ en:
version: "Application version"
members: "Number of members"
admins: "Number of administrators"
managers: "Number of managers"
availabilities: "Number of availabilities of the last 7 days"
reservations: "Number of reservations during the last 7 days"
orders: "Number of store orders during the last 7 days"
plans: "Is the subscription module active?"
spaces: "Is the space management module active?"
online_payment: "Is the online payment module active?"
gateway: "The payment gateway used to collect online payments"
wallet: "Is the wallet module active?"
statistics: "Is the statistics module active?"
trainings: "Is the trainings module active?"
public_agenda: "Is the public_agenda module active?"
machines: "Is the machines module active?"
store: "Is the store module active?"
invoices: "Is the invoicing module active?"
openlab: "Is the project sharing module (OpenLab) active?"
tracking_id_info_html: "To enable the statistical tracking of the visits using Google Analytics V4, set your tracking ID here. It is in the form G-XXXXXX. Visit <a href='https://analytics.google.com/analytics/web/' target='_blank'>the Google Analytics website</a> to get one.<br/><strong>Warning:</strong> if you enable this feature, a cookie will be created. Remember to write it down in your privacy policy, above."