Merge pull request #3987 from betagouv/fix-3986-ROI-Admin
Fix 3986 roi admin
This commit is contained in:
commit
a238be2f2c
4 changed files with 28 additions and 9 deletions
|
@ -64,7 +64,7 @@ En local, un utilisateur de test est créé automatiquement, avec les identifian
|
|||
AutoArchiveProcedureJob.set(cron: "* * * * *").perform_later
|
||||
WeeklyOverviewJob.set(cron: "0 7 * * 1").perform_later
|
||||
AutoReceiveDossiersForProcedureJob.set(cron: "* * * * *").perform_later(procedure_declaratoire_id, Dossier.states.fetch(:en_instruction))
|
||||
SendinblueUpdateAdministrateursJob.set(cron: "0 10 * * *").perform_later
|
||||
UpdateAdministrateurUsageStatisticsJob.set(cron: "0 10 * * *").perform_later
|
||||
FindDubiousProceduresJob.set(cron: "0 0 * * *").perform_later
|
||||
Administrateurs::ActivateBeforeExpirationJob.set(cron: "0 8 * * *").perform_later
|
||||
WarnExpiringDossiersJob.set(cron: "0 0 1 * *").perform_later
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
class UpdateAdministrateurUsageStatisticsJob < ApplicationJob
|
||||
queue_as :cron
|
||||
|
||||
def perform
|
||||
AdministrateurUsageStatisticsService.new.update_administrateurs
|
||||
end
|
||||
|
|
|
@ -24,6 +24,7 @@ class AdministrateurUsageStatisticsService
|
|||
def administrateur_stats(administrateur)
|
||||
nb_dossiers_by_procedure_id = nb_dossiers_by_procedure_id(administrateur.id)
|
||||
nb_dossiers_by_synthetic_state = nb_dossiers_by_synthetic_state(administrateur.id)
|
||||
nb_dossiers_roi = nb_dossiers_by_procedure_id.reject { |procedure_id, _count| is_brouillon(procedure_id) }.map { |_procedure_id, count| count }.sum
|
||||
|
||||
result = {
|
||||
ds_sign_in_count: administrateur.sign_in_count,
|
||||
|
@ -57,7 +58,9 @@ class AdministrateurUsageStatisticsService
|
|||
.map { |_procedure_id, count| count }
|
||||
.max || 0,
|
||||
nb_dossiers_traite: nb_dossiers_by_synthetic_state['termine'],
|
||||
nb_dossiers_dossier_en_instruction: nb_dossiers_by_synthetic_state['en_instruction']
|
||||
nb_dossiers_dossier_en_instruction: nb_dossiers_by_synthetic_state['en_instruction'],
|
||||
admin_roi_low: nb_dossiers_roi * 7.04,
|
||||
admin_roi_high: nb_dossiers_roi * 17.25
|
||||
}
|
||||
|
||||
if administrateur.current_sign_in_at.present?
|
||||
|
|
|
@ -29,7 +29,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 0,
|
||||
nb_dossiers_max: 0,
|
||||
nb_dossiers_traite: 0,
|
||||
nb_dossiers_dossier_en_instruction: 0
|
||||
nb_dossiers_dossier_en_instruction: 0,
|
||||
admin_roi_low: 0,
|
||||
admin_roi_high: 0
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -80,7 +82,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 0,
|
||||
nb_dossiers_max: 0,
|
||||
nb_dossiers_traite: 0,
|
||||
nb_dossiers_dossier_en_instruction: 0
|
||||
nb_dossiers_dossier_en_instruction: 0,
|
||||
admin_roi_low: 0,
|
||||
admin_roi_high: 0
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -108,7 +112,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 21,
|
||||
nb_dossiers_max: 21,
|
||||
nb_dossiers_traite: 7,
|
||||
nb_dossiers_dossier_en_instruction: 7
|
||||
nb_dossiers_dossier_en_instruction: 7,
|
||||
admin_roi_low: 147.84,
|
||||
admin_roi_high: 362.25
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -127,7 +133,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 0,
|
||||
nb_dossiers_max: 0,
|
||||
nb_dossiers_traite: 0,
|
||||
nb_dossiers_dossier_en_instruction: 0
|
||||
nb_dossiers_dossier_en_instruction: 0,
|
||||
admin_roi_low: 0,
|
||||
admin_roi_high: 0
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -155,7 +163,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 0,
|
||||
nb_dossiers_max: 0,
|
||||
nb_dossiers_traite: 0,
|
||||
nb_dossiers_dossier_en_instruction: 0
|
||||
nb_dossiers_dossier_en_instruction: 0,
|
||||
admin_roi_low: 0,
|
||||
admin_roi_high: 0
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -181,7 +191,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 3,
|
||||
nb_dossiers_max: 3,
|
||||
nb_dossiers_traite: 1,
|
||||
nb_dossiers_dossier_en_instruction: 1
|
||||
nb_dossiers_dossier_en_instruction: 1,
|
||||
admin_roi_low: 21.12,
|
||||
admin_roi_high: 51.75
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -209,7 +221,9 @@ describe AdministrateurUsageStatisticsService do
|
|||
nb_dossiers: 21,
|
||||
nb_dossiers_max: 21,
|
||||
nb_dossiers_traite: 7,
|
||||
nb_dossiers_dossier_en_instruction: 7
|
||||
nb_dossiers_dossier_en_instruction: 7,
|
||||
admin_roi_low: 147.84,
|
||||
admin_roi_high: 362.25
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue