Commit graph

102 commits

Author SHA1 Message Date
Pierre de La Morinerie
e6cf07b810 stats: move date formatting out of the Stat model
Before this commit, the monthly dossiers count was serialized into the
Stat record using human-formatted dates, as:

```ruby
s.dossiers_in_the_last_4_months = {
  "octobre 2021"=>409592,
  "novembre 2021"=>497823,
  "décembre 2021"=>38170,
  "janvier 2022"=>0
}
```

Turns out the ordering of keys in a serialized hash is not guaranteed.
After a round-trip to the database, the keys will be wrongly sorted.

Instead we want to save raw Date objects, which will preserve the
ordering. The date formatting can be applied at display-time by the
controller.

Fix #6848
2022-02-02 14:13:53 +01:00
maatinito
0a31c8bc79 refactor date_trunc queries using groupdate gem 2021-12-14 08:50:11 +01:00
maatinito
573b3d39e2 Fix date_trunc sql queries for timezoned forks 2021-12-14 08:50:09 +01:00
maatinito
9df0d98109 Fix csv download of stats
https://medium.com/@mitsun.chieh/activerecord-relation-with-raw-sql-argument-returns-a-warning-exception-raising-8999f1b9898a
2021-12-10 16:48:11 +01:00
Paul Chavard
2ba05bfb4f fix(dossier): use depose_at instead of en_construction_at 2021-12-06 15:49:17 +01:00
Paul Chavard
46e2e34b89 fix(stats): remove super admin stats 2021-12-01 18:10:05 +01:00
François Vantomme
c9b1095d1e Refactor (Rubocop): replace map{ … }.compact by filter_map
In Ruby 2.7, Enumerable#filter_map has been added.
This cop identifies places where map { … }.compact can be replaced by filter_map.

See: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-06-11 15:38:09 +02:00
Paul Chavard
2a068fb9b0 Remove user feedback buttons 2021-04-22 15:40:40 +01:00
Christophe Robillard
5562e65bf3 refacto: rename administration to super_admin 2020-11-05 16:03:55 +01:00
simon lehericey
ad01d4dee5 really faster stats by precomputing some of them 2020-10-06 16:12:01 +02:00
simon lehericey
f5f363ae99 add 3 counts to @dossiers_states 2020-10-06 16:12:01 +02:00
simon lehericey
e9adcdd7fc add @dossiers_states to compute more dossier count 2020-10-06 16:12:01 +02:00
simon lehericey
6e17eeb635 reduce dossiers count 2020-10-06 16:12:01 +02:00
clemkeirua
2cb3b1c68e more idiomatic count 2020-09-25 12:53:11 +00:00
Paul Chavard
ec72fdd164 Remove migration service 2020-09-02 11:26:26 +02:00
Christophe Robillard
cea170e4a6 update stats with traitement model 2020-07-08 18:15:15 +02:00
Paul Chavard
3cd4597006 Update rubocop roules 2020-03-17 11:25:21 +01:00
Paul Chavard
7b947feae4 Rename demarche archivée to demarche close 2019-11-28 15:07:16 +01:00
maatinito
9de9a1fd71 Use time.zone functions instead of server time functions
(Time.zone.today vs Date.today)
2019-11-26 14:26:36 +01:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Pierre de La Morinerie
503c393a87 helpscout: use replies_sent to compute contact rate
The `conversations_count` we previously used counts replies, but also
all conversations that were tagged or re-tagged during the month – with
made counting the actual work spent on user support brittle.

Counting the replies is a better estimation of what we get.

Unfortunately this also removes the filtering-by-tag feature. To
mitigate this, the reports are now scoped to a specific mailbox. This
allows to create extra mailboxes for conversations that should't be
counted in the stats.
2019-09-11 17:26:10 +02:00
simon lehericey
6a83adf336 StatController: work by groupe_instructeur 2019-09-03 06:47:02 +02:00
Pierre de La Morinerie
a8050ce136 stats: display only the last year of contact rate 2019-04-02 17:22:38 +02:00
Pierre de La Morinerie
031c40aa55 stats: display 12 weeks of feedbacks 2019-04-02 17:22:38 +02:00
Paul Chavard
0e4b6e1ba2 Remove “Nombre d'administrations ayant dématérialisé N démarches” graph 2019-03-12 11:59:01 +01:00
Paul Chavard
01b966ff66 Check demarche ownership on multiple administrateurs 2019-03-12 11:59:01 +01:00
maatinito
766e9db752 converting DateTime to Date looses time zone information resulting in bad time computing
Specifically, for Tahiti, time zone is -10 so after 14h, UTC time is Tahiti time + 10h i.e the day after. Loosing time zone results in 1 day difference whether the time is computed before of after 14h :-)
2019-03-08 17:58:58 +01:00
Pierre de La Morinerie
34a2dc6b97 stats: turn satisfaction into a stacked area chart 2019-02-01 11:02:37 +01:00
Pierre de La Morinerie
ac88d1cc1d stats: display the last day of the range (instead of the first day) 2019-01-10 16:17:00 +01:00
Pierre de La Morinerie
908771e172 stats: use group_by_week to compute the week range
Fix #3242
2019-01-10 16:17:00 +01:00
Pierre de La Morinerie
5a36546485 layouts: rename "application" to "application_old" 2019-01-07 12:17:05 +01:00
Pierre de La Morinerie
86b9e2d092 stats: fix exception when HelpScout env vars are missing
This fixes the stats page, which used to raise an exception when
HelpScout env vars are not present.
2019-01-03 17:27:56 +01:00
Pierre de La Morinerie
efae27b901 stats: start helpscout stats at 01-2018
Data before is very variable, as it is based on a low dossiers count.
2019-01-03 17:23:22 +01:00
gregoirenovel
0596d53ac2 Enable the Lint/UnusedBlockArgument cop 2019-01-03 10:53:50 +01:00
gregoirenovel
baf7977786 Enable the Lint/StringConversionInInterpolation cop 2019-01-03 10:53:50 +01:00
gregoirenovel
a8f700b572 Enable the Style/FormatString cop 2018-12-19 13:56:10 +01:00
Pierre de La Morinerie
d614ea6bd5 stats: display contact rate 2018-12-18 10:38:59 +01:00
simon lehericey
2238e5bd9f Time.now => Time.zone.now 2018-10-26 10:10:20 +00:00
simon lehericey
fd9bdbf31d StatsController: avoid doing useless queries 2018-10-18 11:50:43 +02:00
simon lehericey
aff085bb6b StatsController: avoid division by nil 2018-10-16 18:02:00 +02:00
simon lehericey
3d51b7f4a3 so crazy right now 2018-10-15 14:55:07 +02:00
simon lehericey
21e3dc1498 Let the stats be great again 2018-10-15 14:55:07 +02:00
simon lehericey
17b100b4e9 ControllerStat: renaming 2018-10-15 14:55:07 +02:00
gregoirenovel
d1439f8a52 Enable Style/YodaCondition 2018-10-03 12:00:17 +02:00
gregoirenovel
50019e5317 Show user satisfaction in percentages 2018-09-11 10:17:40 +02:00
gregoirenovel
26e0ada3d4 Improve the ratings stats
Make sure that for each data point, we have do not
have any partial data (e.g. a week that hasn’t
finished yet)
2018-09-11 10:17:40 +02:00
gregoirenovel
00ecae5f93 Procédure → Démarche 2018-09-05 15:46:24 +02:00
gregoirenovel
d05209d28f Make the stats code more robust to empty databases 2018-09-03 17:35:14 +02:00
gregoirenovel
e60aa0c37b Use scopes when possible 2018-08-30 13:16:14 +02:00
gregoirenovel
15d1b01a90 Code simplification 2018-08-30 13:16:14 +02:00