sleede/fab-manager

Exportation des membres

dilo145 opened this issue · 3 comments

Bonjour,

Le bug c'est que le bouton "Membres" dans l'onglet "Utilisateurs' ne fonctionne pas, donc il n'est pas possible d'exporter les membres vers un fichier .xlsx (comme les réservations) sauf s'il n'y a aucun membre où on a un fichier .xlsx qui est presque vide (il n'y a que les colonnes id, nom...).
Une notification nous dit qu'on sera notifié quand le ficher sera prêt mais dans les logs du serveur, on voit que le "worker.1" n'est pas exécuté ou appelé comme pour les réservations.

  1. Allez dans "Utilisateurs"
  2. Clickez sur le bouton "Membres"
    (Comparez avec le bouton "Réservations")
  • Fab-manager version 4.7.12

Merci d'avance,

dilo145

Salut,

Étrangement je ne reproduit pas ce bug avec la dernière version. C'est sans doute un problème lié aux données ... Peux-tu poster ici un extrait de /apps/fabmanager/log/worker-stdout.log ? (tu peux faire une recherche dans le fichier sur UsersExportWorker pour ne rapporter que la partie partinente du fichier)

Merci d'avance

Pour la v.4.7.12, elle est en ligne et je ne sais pas comment avoir les logs de celui-ci mais je suis en train de tester aussi avec un serveur de développement avec la v.5.0.2.
Je n'ai pas le fichier demandé /apps/fabmanager/log/worker-stdout.log mais j'ai /apps/fabmanager/log/developement.log et voici les logs quand je click sur "Membres" :

PS : Aucun résultat sur UsersExportWorker.
Les '�' c'est illisible aussi sur le fichier log.

Started GET "/api/notifications/polling?last_poll=2021-06-21T09:29:54.876Z" for 127.0.0.1 at 2021-06-21 11:30:24 +0200
Processing by API::NotificationsController#polling as JSON
  Parameters: {"last_poll"=>"2021-06-21T09:29:54.876Z"}
  �[1m�[36mUser Load (0.6ms)�[0m  �[1m�[34mSELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2�[0m  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:81
  �[1m�[36mSetting Load (0.4ms)�[0m  �[1m�[34mSELECT  "settings".* FROM "settings" WHERE "settings"."name" = $1 LIMIT $2�[0m  [["name", "confirmation_required"], ["LIMIT", 1]]
  ↳ app/models/setting.rb:164
  �[1m�[36mHistoryValue Load (0.4ms)�[0m  �[1m�[34mSELECT  "history_values".* FROM "history_values" WHERE "history_values"."setting_id" = $1 ORDER BY "history_values"."created_at" DESC LIMIT $2�[0m  [["setting_id", 51], ["LIMIT", 1]]
  ↳ app/models/setting.rb:124
  �[1m�[35m (0.5ms)�[0m  �[1m�[34mSELECT COUNT(*) FROM "notifications" WHERE "notifications"."receiver_id" = $1 AND "notifications"."receiver_type" = $2�[0m  [["receiver_id", 1], ["receiver_type", "User"]]
  ↳ app/controllers/api/notifications_controller.rb:43
  �[1m�[35m (0.5ms)�[0m  �[1m�[34mSELECT COUNT(*) FROM "notifications" WHERE "notifications"."receiver_id" = $1 AND "notifications"."receiver_type" = $2 AND "notifications"."is_read" = $3�[0m  [["receiver_id", 1], ["receiver_type", "User"], ["is_read", false]]
  ↳ app/controllers/api/notifications_controller.rb:44
  Rendering api/notifications/index.json.jbuilder
  �[1m�[36mNotification Load (0.5ms)�[0m  �[1m�[34mSELECT "notifications".* FROM "notifications" WHERE "notifications"."receiver_id" = $1 AND "notifications"."receiver_type" = $2 AND (is_read = false AND created_at >= '2021-06-21T09:29:54.876Z') ORDER BY created_at DESC�[0m  [["receiver_id", 1], ["receiver_type", "User"]]
  ↳ app/views/api/notifications/index.json.jbuilder:2
  Rendered api/notifications/index.json.jbuilder (1.8ms)
Completed 200 OK in 15ms (Views: 4.7ms | ActiveRecord: 2.9ms | Elasticsearch: 0.0ms)


Started POST "/api/exports/status" for 127.0.0.1 at 2021-06-21 11:30:28 +0200
Processing by API::ExportsController#status as JSON
  Parameters: {"category"=>"users", "type"=>"members", "export"=>{"category"=>"users"}}
  �[1m�[36mUser Load (0.5ms)�[0m  �[1m�[34mSELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2�[0m  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:81
  �[1m�[36mSetting Load (0.4ms)�[0m  �[1m�[34mSELECT  "settings".* FROM "settings" WHERE "settings"."name" = $1 LIMIT $2�[0m  [["name", "confirmation_required"], ["LIMIT", 1]]
  ↳ app/models/setting.rb:164
  �[1m�[36mHistoryValue Load (0.5ms)�[0m  �[1m�[34mSELECT  "history_values".* FROM "history_values" WHERE "history_values"."setting_id" = $1 ORDER BY "history_values"."created_at" DESC LIMIT $2�[0m  [["setting_id", 51], ["LIMIT", 1]]
  ↳ app/models/setting.rb:124
  �[1m�[36mRole Load (0.7ms)�[0m  �[1m�[34mSELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))�[0m  [["user_id", 1]]
  ↳ app/models/user.rb:145
  �[1m�[35m (0.9ms)�[0m  �[1m�[34mSELECT MAX("users"."updated_at") FROM "users" INNER JOIN "users_roles" ON "users_roles"."user_id" = "users"."id" INNER JOIN "roles" ON "roles"."id" = "users_roles"."role_id" WHERE (((roles.name = 'member') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))�[0m
  ↳ app/controllers/api/exports_controller.rb:58
  �[1m�[36mExport Load (0.5ms)�[0m  �[1m�[34mSELECT  "exports".* FROM "exports" WHERE "exports"."category" = $1 AND "exports"."export_type" = $2 AND "exports"."query" IS NULL AND "exports"."key" IS NULL AND "exports"."extension" IS NULL AND (created_at > '2021-06-21 09:16:05.148179') ORDER BY "exports"."id" DESC LIMIT $3�[0m  [["category", "users"], ["export_type", "members"], ["LIMIT", 1]]
  ↳ app/controllers/api/exports_controller.rb:79
Completed 200 OK in 14ms (Views: 0.3ms | ActiveRecord: 3.5ms | Elasticsearch: 0.0ms)


Started GET "/api/members/export_members.xlsx" for 127.0.0.1 at 2021-06-21 11:30:28 +0200
Processing by API::MembersController#export_members as XLSX
  �[1m�[36mUser Load (0.5ms)�[0m  �[1m�[34mSELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2�[0m  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:81
  �[1m�[36mSetting Load (0.5ms)�[0m  �[1m�[34mSELECT  "settings".* FROM "settings" WHERE "settings"."name" = $1 LIMIT $2�[0m  [["name", "confirmation_required"], ["LIMIT", 1]]
  ↳ app/models/setting.rb:164
  �[1m�[36mHistoryValue Load (0.3ms)�[0m  �[1m�[34mSELECT  "history_values".* FROM "history_values" WHERE "history_values"."setting_id" = $1 ORDER BY "history_values"."created_at" DESC LIMIT $2�[0m  [["setting_id", 51], ["LIMIT", 1]]
  ↳ app/models/setting.rb:124
  �[1m�[36mRole Load (0.7ms)�[0m  �[1m�[34mSELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))�[0m  [["user_id", 1]]
  ↳ app/models/user.rb:145
  �[1m�[35m (0.9ms)�[0m  �[1m�[34mSELECT MAX("users"."updated_at") FROM "users" INNER JOIN "users_roles" ON "users_roles"."user_id" = "users"."id" INNER JOIN "roles" ON "roles"."id" = "users_roles"."role_id" WHERE (((roles.name = 'member') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))�[0m
  ↳ app/controllers/api/members_controller.rb:119
  �[1m�[35m (1.0ms)�[0m  �[1m�[34mSELECT MAX("profiles"."updated_at") FROM "profiles" WHERE "profiles"."user_id" IN (SELECT "users"."id" FROM "users" INNER JOIN "users_roles" ON "users_roles"."user_id" = "users"."id" INNER JOIN "roles" ON "roles"."id" = "users_roles"."role_id" WHERE (((roles.name = 'member') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))))�[0m
  ↳ app/controllers/api/members_controller.rb:120
  �[1m�[35m (0.9ms)�[0m  �[1m�[34mSELECT MAX("invoicing_profiles"."updated_at") FROM "invoicing_profiles" WHERE "invoicing_profiles"."user_id" IN (SELECT "users"."id" FROM "users" INNER JOIN "users_roles" ON "users_roles"."user_id" = "users"."id" INNER JOIN "roles" ON "roles"."id" = "users_roles"."role_id" WHERE (((roles.name = 'member') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))))�[0m
  ↳ app/controllers/api/members_controller.rb:121
  �[1m�[35m (0.9ms)�[0m  �[1m�[34mSELECT MAX("statistic_profiles"."updated_at") FROM "statistic_profiles" WHERE "statistic_profiles"."user_id" IN (SELECT "users"."id" FROM "users" INNER JOIN "users_roles" ON "users_roles"."user_id" = "users"."id" INNER JOIN "roles" ON "roles"."id" = "users_roles"."role_id" WHERE (((roles.name = 'member') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL))))�[0m
  ↳ app/controllers/api/members_controller.rb:122
  �[1m�[35m (0.4ms)�[0m  �[1m�[34mSELECT MAX("subscriptions"."updated_at") FROM "subscriptions"�[0m
  ↳ app/controllers/api/members_controller.rb:123
Completed 500 Internal Server Error in 18ms (ActiveRecord: 6.2ms | Elasticsearch: 0.0ms)


  
ArgumentError (comparison of NilClass with Time failed):
  
app/controllers/api/members_controller.rb:118:in `export_members'
app/controllers/application_controller.rb:69:in `switch_locale'

Ok je pense que je vois le problème.
Si aucun abonnement n'a été pris Subscription.maximum('updated_at') retourne nil ... d'où l'erreur comparison of NilClass with Time failed.

Je corrige ça de suite ;)