feat(stats#index): update Stat model to also query DossierDeleted in stats computation

tech(question): discard_and_keep_track! ; are we really keeping track with default_scope { kept } ?

feat(stats): add DeletedDossier in Stat computations

Revert "tech(question): discard_and_keep_track! ; are we really keeping track with default_scope { kept } ?"

This reverts commit d1155b7eeaaf1a9f80189e59667e109541fcb089.

feat(stats): support deleted_dossiers for last_four_months_hash and cumulative_hash. extract sanitize query & merge hashes in methdos

clean(rubocop): lint with rubocop

Update db/migrate/20211126080118_add_index_to_deleted_at_to_deleted_dossiers.rb

Co-authored-by: LeSim <mail@simon.lehericey.net>

fix(rubocop): avoid uneeded allocation

fix(migration): add concurrent index with expected synthax

fix(brakeman): add ignore message since group date_trunc evaluation is used by only ourself
This commit is contained in:
Martin 2021-11-25 09:11:05 +01:00
parent 783b0ed9f0
commit 970e43efb8
5 changed files with 225 additions and 37 deletions

View file

@ -0,0 +1,11 @@
class AddIndexToDeletedAtToDeletedDossiers < ActiveRecord::Migration[6.1]
include Database::MigrationHelpers
disable_ddl_transaction!
def up
add_concurrent_index :deleted_dossiers, :deleted_at
end
def down
remove_index :deleted_dossiers, [:deleted_at]
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_11_24_111429) do
ActiveRecord::Schema.define(version: 2021_11_26_080118) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -253,6 +253,7 @@ ActiveRecord::Schema.define(version: 2021_11_24_111429) do
t.bigint "user_id"
t.bigint "groupe_instructeur_id"
t.bigint "revision_id"
t.index ["deleted_at"], name: "index_deleted_dossiers_on_deleted_at"
t.index ["dossier_id"], name: "index_deleted_dossiers_on_dossier_id", unique: true
t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id"
end