From 675eb46e9dc84960be84864df2492cbe448b1f01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2019 14:22:37 +0000 Subject: [PATCH 1/5] Bump mixin-deep from 1.3.1 to 1.3.2 Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2. - [Release notes](https://github.com/jonschlinkert/mixin-deep/releases) - [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 129f3123c..5afa1da8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5398,9 +5398,9 @@ mississippi@^3.0.0: through2 "^2.0.0" mixin-deep@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" - integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ== + version "1.3.2" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" + integrity sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA== dependencies: for-in "^1.0.2" is-extendable "^1.0.1" From d94a5cee8ecc6ad2c0bad2b29d5487cc575eb4ae Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 10 Sep 2019 16:08:38 +0200 Subject: [PATCH 2/5] spec: during js specs, cleanup database using deletion This attempts to solve the database deadlock on cleanup by fiddling with the settings. Ref #4293 --- spec/support/database_cleaner.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb index ef931aa87..553e7ce34 100644 --- a/spec/support/database_cleaner.rb +++ b/spec/support/database_cleaner.rb @@ -10,7 +10,7 @@ RSpec.configure do |config| end config.before(:each, js: true) do - DatabaseCleaner.strategy = :truncation, { except: expect_list } + DatabaseCleaner.strategy = :deletion, { except: expect_list } end config.before(:each) do From c370c2f475b64621fb0f944350cebf4184daa360 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 10 Sep 2019 17:31:24 +0200 Subject: [PATCH 3/5] Cleanup FlipFlop --- Gemfile | 1 - Gemfile.lock | 3 --- app/models/administrateur.rb | 2 ++ app/models/instructeur.rb | 1 + app/services/administrateur_usage_statistics_service.rb | 1 - spec/services/administrateur_usage_statistics_service_spec.rb | 3 --- 6 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 8849da0e9..0286da028 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,6 @@ gem 'delayed_job_web' gem 'devise' # Gestion des comptes utilisateurs gem 'devise-async' gem 'dotenv-rails', require: 'dotenv/rails-now' # dotenv should always be loaded before rails -gem 'flipflop' gem 'flipper' gem 'flipper-active_record' gem 'flipper-ui' diff --git a/Gemfile.lock b/Gemfile.lock index 9bf075646..6ee007053 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -220,8 +220,6 @@ GEM faraday (0.15.4) multipart-post (>= 1.2, < 3) ffi (1.9.25) - flipflop (2.4.0) - activesupport (>= 4.0) flipper (0.16.2) flipper-active_record (0.16.2) activerecord (>= 3.2, < 6) @@ -733,7 +731,6 @@ DEPENDENCIES devise-async dotenv-rails factory_bot - flipflop flipper flipper-active_record flipper-ui diff --git a/app/models/administrateur.rb b/app/models/administrateur.rb index 738281e29..ed29cc034 100644 --- a/app/models/administrateur.rb +++ b/app/models/administrateur.rb @@ -1,4 +1,6 @@ class Administrateur < ApplicationRecord + self.ignored_columns = ['features'] + include EmailSanitizableConcern include ActiveRecord::SecureToken diff --git a/app/models/instructeur.rb b/app/models/instructeur.rb index 08087b61e..d9fd18dc9 100644 --- a/app/models/instructeur.rb +++ b/app/models/instructeur.rb @@ -1,4 +1,5 @@ class Instructeur < ApplicationRecord + self.ignored_columns = ['features'] include EmailSanitizableConcern has_and_belongs_to_many :administrateurs diff --git a/app/services/administrateur_usage_statistics_service.rb b/app/services/administrateur_usage_statistics_service.rb index 44d5cba6a..d7351e859 100644 --- a/app/services/administrateur_usage_statistics_service.rb +++ b/app/services/administrateur_usage_statistics_service.rb @@ -31,7 +31,6 @@ class AdministrateurUsageStatisticsService ds_created_at: administrateur.created_at, ds_active: administrateur.active, ds_id: administrateur.id, - ds_features: administrateur.features.to_json, nb_services: nb_services_by_administrateur_id[administrateur.id], nb_instructeurs: nb_instructeurs_by_administrateur_id[administrateur.id], diff --git a/spec/services/administrateur_usage_statistics_service_spec.rb b/spec/services/administrateur_usage_statistics_service_spec.rb index 60eb299f0..3133e4a28 100644 --- a/spec/services/administrateur_usage_statistics_service_spec.rb +++ b/spec/services/administrateur_usage_statistics_service_spec.rb @@ -17,7 +17,6 @@ describe AdministrateurUsageStatisticsService do ds_created_at: Time.zone.now, ds_active: false, ds_id: administrateur.id, - ds_features: "{}", nb_services: 0, nb_instructeurs: 0, ds_nb_demarches_actives: 0, @@ -43,7 +42,6 @@ describe AdministrateurUsageStatisticsService do current_sign_in_at: Time.zone.local(2019, 3, 7), last_sign_in_at: Time.zone.local(2019, 2, 27), active: true, - features: { holy_hand_grenade_of_antioch: true }, services: [create(:service)], instructeurs: [create(:instructeur)]) end @@ -56,7 +54,6 @@ describe AdministrateurUsageStatisticsService do ds_created_at: Time.zone.now, ds_active: true, ds_id: administrateur.id, - ds_features: { holy_hand_grenade_of_antioch: true }.to_json, nb_services: 1, nb_instructeurs: 1 ) From 503c393a876ea5455815fd4cffacb2f3802e75eb Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 11 Sep 2019 15:16:48 +0000 Subject: [PATCH 4/5] helpscout: use replies_sent to compute contact rate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/controllers/stats_controller.rb | 3 +- app/lib/helpscout/api.rb | 17 ++++--- .../helpscout/user_conversations_adapter.rb | 23 +++------ app/views/stats/index.html.haml | 7 ++- .../helpscout_conversations_reports.yml | 50 +++++++++---------- .../user_conversations_adapter_spec.rb | 19 ++++--- 6 files changed, 57 insertions(+), 62 deletions(-) diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index edcda5802..f5563e8a5 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -13,7 +13,6 @@ class StatsController < ApplicationController @satisfaction_usagers = satisfaction_usagers @contact_percentage = contact_percentage - @contact_percentage_excluded_tags = Helpscout::UserConversationsAdapter::EXCLUDED_TAGS @dossiers_states = dossiers_states @@ -177,7 +176,7 @@ class StatsController < ApplicationController .map do |monthly_report| start_date = monthly_report[:start_date].to_time.localtime end_date = monthly_report[:end_date].to_time.localtime - replies_count = monthly_report[:conversations_count] + replies_count = monthly_report[:replies_sent] dossiers_count = Dossier.where(en_construction_at: start_date..end_date).count diff --git a/app/lib/helpscout/api.rb b/app/lib/helpscout/api.rb index f6432760a..127002854 100644 --- a/app/lib/helpscout/api.rb +++ b/app/lib/helpscout/api.rb @@ -26,7 +26,7 @@ class Helpscout::API body = { subject: subject, customer: customer(email), - mailboxId: mailbox_id, + mailboxId: user_support_mailbox_id, type: 'email', status: 'active', threads: [ @@ -44,7 +44,7 @@ class Helpscout::API def add_phone_number(email, phone) query = URI.encode("(email:#{email})") - response = call_api(:get, "#{CUSTOMERS}?mailbox=#{mailbox_id}&query=#{query}") + response = call_api(:get, "#{CUSTOMERS}?mailbox=#{user_support_mailbox_id}&query=#{query}") if response.success? body = parse_response_body(response) if body[:page][:totalElements] > 0 @@ -57,17 +57,18 @@ class Helpscout::API end end - def conversations_report(year, month) - Rails.logger.info("[HelpScout API] Retrieving conversations report for #{month}-#{year}…") + def productivity_report(year, month) + Rails.logger.info("[HelpScout API] Retrieving productivity report for #{month}-#{year}…") params = { + mailboxes: [user_support_mailbox_id].join(','), start: Time.utc(year, month).iso8601, end: Time.utc(year, month).next_month.iso8601 } - response = call_api(:get, 'reports/conversations?' + params.to_query) + response = call_api(:get, 'reports/productivity?' + params.to_query) if !response.success? - raise StandardError, "Error while fetching conversation report: #{response.response_code} '#{response.body}'" + raise StandardError, "Error while fetching productivity report: #{response.response_code} '#{response.body}'" end parse_response_body(response) @@ -107,7 +108,7 @@ class Helpscout::API end def fetch_custom_fields - call_api(:get, "#{MAILBOXES}/#{mailbox_id}/#{FIELDS}") + call_api(:get, "#{MAILBOXES}/#{user_support_mailbox_id}/#{FIELDS}") end def call_api(method, path, body = nil) @@ -135,7 +136,7 @@ class Helpscout::API JSON.parse(response.body, symbolize_names: true) end - def mailbox_id + def user_support_mailbox_id Rails.application.secrets.helpscout[:mailbox_id] end diff --git a/app/lib/helpscout/user_conversations_adapter.rb b/app/lib/helpscout/user_conversations_adapter.rb index f62662a0d..ced3a1b66 100644 --- a/app/lib/helpscout/user_conversations_adapter.rb +++ b/app/lib/helpscout/user_conversations_adapter.rb @@ -1,7 +1,5 @@ # Fetch and compute monthly reports about the users conversations on Helpscout class Helpscout::UserConversationsAdapter - EXCLUDED_TAGS = ['openlab', 'bizdev', 'admin', 'webinaire'] - def initialize(from, to) @from = from @to = to @@ -23,19 +21,12 @@ class Helpscout::UserConversationsAdapter private def report(year, month) - report = fetch_conversations_report(year, month) - - total_conversations = report.dig(:current, :totalConversations) - excluded_conversations = report - .dig(:tags, :top) - .select { |tag| tag[:name]&.in?(EXCLUDED_TAGS) } - .map { |tag| tag[:count] } - .sum + report = fetch_productivity_report(year, month) { - start_date: report.dig(:current, :startDate).to_datetime, - end_date: report.dig(:current, :endDate).to_datetime, - conversations_count: total_conversations - excluded_conversations + start_date: report.dig(:current, :startDate).to_datetime, + end_date: report.dig(:current, :endDate).to_datetime, + replies_sent: report.dig(:current, :repliesSent) } end @@ -43,13 +34,13 @@ class Helpscout::UserConversationsAdapter @api_client ||= Helpscout::API.new end - def fetch_conversations_report(year, month) + def fetch_productivity_report(year, month) if year == Date.today.year && month == Date.today.month raise ArgumentError, 'The report for the current month will change in the future, and cannot be cached.' end - Rails.cache.fetch("helpscout-conversation-report-#{year}-#{month}") do - api_client.conversations_report(year, month) + Rails.cache.fetch("helpscout-productivity-report-#{year}-#{month}") do + api_client.productivity_report(year, month) end end end diff --git a/app/views/stats/index.html.haml b/app/views/stats/index.html.haml index 9a3f1a5c1..b69647565 100644 --- a/app/views/stats/index.html.haml +++ b/app/views/stats/index.html.haml @@ -34,16 +34,15 @@ .stat-card.stat-card-half.pull-left %span.stat-card-title - Pourcentage de contact usager + Pourcentage de contact utilisateur .chart-container .chart = line_chart @contact_percentage .stat-card-details - %abbr{ title: "À l’exception des conversations taggées #{@contact_percentage_excluded_tags.join(', ')}" } - Nombre de conversations actives dans HelpScout - %span / nombre de dossiers déposés + Nombre de réponses envoyées via HelpScout + \/ nombre de dossiers déposés .stat-card.stat-card-half.pull-left %span.stat-card-title diff --git a/spec/fixtures/cassettes/helpscout_conversations_reports.yml b/spec/fixtures/cassettes/helpscout_conversations_reports.yml index 6fa4c21b8..e8c3fd044 100644 --- a/spec/fixtures/cassettes/helpscout_conversations_reports.yml +++ b/spec/fixtures/cassettes/helpscout_conversations_reports.yml @@ -5,7 +5,7 @@ http_interactions: uri: https://api.helpscout.net/v2/oauth2/token body: encoding: UTF-8 - string: client_id&client_secret&grant_type=client_credentials + string: client_id=1234&client_secret=5678&grant_type=client_credentials headers: User-Agent: - demarches-simplifiees.fr @@ -23,7 +23,7 @@ http_interactions: Content-Type: - application/json; charset=utf-8 Date: - - Thu, 13 Dec 2018 12:49:04 GMT + - Wed, 11 Sep 2019 15:02:24 GMT Pragma: - no-cache Content-Length: @@ -32,14 +32,14 @@ http_interactions: - keep-alive body: encoding: UTF-8 - string: '{"token_type":"bearer","access_token":"18mock9b","expires_in":7200} + string: '{"token_type":"bearer","access_token":"redacted","expires_in":7200} ' http_version: - recorded_at: Thu, 13 Dec 2018 12:49:05 GMT + recorded_at: Wed, 11 Sep 2019 15:02:24 GMT - request: method: get - uri: https://api.helpscout.net/v2/reports/conversations?end=2017-12-01T00:00:00Z&start=2017-11-01T00:00:00Z + uri: https://api.helpscout.net/v2/reports/productivity?end=2017-12-01T00:00:00Z&mailboxes=9999&start=2017-11-01T00:00:00Z body: encoding: US-ASCII string: '' @@ -47,7 +47,7 @@ http_interactions: User-Agent: - demarches-simplifiees.fr Authorization: - - Bearer 18mock9b + - Bearer redacted Content-Type: - application/json; charset=UTF-8 Expect: @@ -64,9 +64,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Correlation-Id: - - a6ee3949-ec16-4b39-92bc-3600adc3f671#144730730 + - 23f037f4-3974-4c8f-b252-3a580e4400dc#3293935 Date: - - Thu, 13 Dec 2018 12:49:05 GMT + - Wed, 11 Sep 2019 15:02:24 GMT Expires: - '0' Pragma: @@ -77,24 +77,23 @@ http_interactions: X-Frame-Options: - DENY X-Ratelimit-Limit-Minute: - - '200' + - '400' X-Ratelimit-Remaining-Minute: - - '199' + - '399' X-Xss-Protection: - 1; mode=block Content-Length: - - '5434' + - '2551' Connection: - keep-alive body: - encoding: ASCII-8BIT - string: !binary |- - eyJyZXBsaWVzIjp7ImNvdW50IjoyMTYsInRvcCI6W3sibmFtZSI6Ik1hdXZhaXMgaW50ZXJsb2N1dGV1ciIsImlkIjo3MjczOTYsIm1haWxib3hJZCI6MTI1OTI2LCJjb3VudCI6OSwicGVyY2VudCI6NC4xNjY2NjY2NjY2NjY2NjZ9LHsibmFtZSI6IkRlb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I1LCJjb3VudCI6MSwicGVyY2VudCI6MC40NjI5NjI5NjI5NjI5NjI5fSx7Im5hbWUiOiJCb2lzc29uIFRob21hcyIsImlkIjoxNDc4MTQ3OTUsImNvdW50IjoxLCJwZXJjZW50IjowLjQ2Mjk2Mjk2Mjk2Mjk2Mjl9XX0sImJ1c2llc3REYXkiOnsiZGF5Ijo0LCJob3VyIjowLCJjb3VudCI6NDZ9LCJmaWx0ZXJUYWdzIjpbXSwiYnVzeVRpbWVFbmQiOjE1LCJidXN5VGltZVN0YXJ0IjoxMywidGFnSWRzIjpbIjEiXSwiY3VycmVudCI6eyJzdGFydERhdGUiOiIyMDE3LTExLTAxVDAwOjAwOjAwWiIsImVuZERhdGUiOiIyMDE3LTEyLTAxVDAwOjAwOjAwWiIsInRvdGFsQ29udmVyc2F0aW9ucyI6MjE2LCJjb252ZXJzYXRpb25zQ3JlYXRlZCI6MTc4LCJuZXdDb252ZXJzYXRpb25zIjoxNzgsImN1c3RvbWVycyI6MTUwLCJtZXNzYWdlc1JlY2VpdmVkIjoyOTMsImNvbnZlcnNhdGlvbnNQZXJEYXkiOjZ9LCJjdXN0b21GaWVsZHMiOnsiZmllbGRzIjpbXSwiY291bnQiOjB9fQ== + encoding: UTF-8 + string: '{"filterTags":[{"name":"administration","id":3745889},{"name":"caf","id":4276799}],"current":{"startDate":"2017-11-01T00:00:00Z","endDate":"2017-12-01T00:00:00Z","totalConversations":96,"resolutionTime":182589.09375,"repliesToResolve":1.625,"responseTime":178804,"firstResponseTime":106231,"resolved":96,"resolvedOnFirstReply":64,"closed":181,"repliesSent":187,"handleTime":402,"percentResolvedOnFirstReply":66.66666666666666,"ratings":[],"newConversations":178,"messagesReceived":293,"createdInHS":11},"responseTime":{"count":113,"previousCount":0,"ranges":[{"id":10,"count":22,"percent":19.469026548672566},{"id":3,"count":13,"percent":11.504424778761061},{"id":9,"count":13,"percent":11.504424778761061},{"id":1,"count":12,"percent":10.619469026548673},{"id":7,"count":12,"percent":10.619469026548673},{"id":2,"count":11,"percent":9.734513274336283},{"id":6,"count":11,"percent":9.734513274336283},{"id":5,"count":7,"percent":6.1946902654867255},{"id":4,"count":6,"percent":5.3097345132743365},{"id":8,"count":6,"percent":5.3097345132743365}]},"handleTime":{"count":96,"previousCount":0,"ranges":[{"id":3,"count":32,"percent":33.33333333333333},{"id":1,"count":25,"percent":26.041666666666668},{"id":2,"count":18,"percent":18.75},{"id":4,"count":11,"percent":11.458333333333332},{"id":5,"count":10,"percent":10.416666666666668}]},"firstResponseTime":{"count":113,"previousCount":0,"ranges":[{"id":10,"count":18,"percent":15.929203539823009},{"id":2,"count":14,"percent":12.389380530973451},{"id":3,"count":13,"percent":11.504424778761061},{"id":8,"count":12,"percent":10.619469026548673},{"id":9,"count":12,"percent":10.619469026548673},{"id":1,"count":11,"percent":9.734513274336283},{"id":4,"count":11,"percent":9.734513274336283},{"id":6,"count":11,"percent":9.734513274336283},{"id":7,"count":7,"percent":6.1946902654867255},{"id":5,"count":4,"percent":3.5398230088495577}]},"resolutionTime":{"count":96,"previousCount":0,"ranges":[{"id":1,"count":43,"percent":44.79166666666667},{"id":2,"count":21,"percent":21.875},{"id":5,"count":12,"percent":12.5},{"id":3,"count":11,"percent":11.458333333333332},{"id":4,"count":9,"percent":9.375}]},"repliesToResolve":{"count":96,"previousCount":0,"ranges":[{"id":1,"count":64,"percent":66.66666666666666,"resolutionTime":127669},{"id":2,"count":20,"percent":20.833333333333336,"resolutionTime":331855},{"id":3,"count":5,"percent":5.208333333333334,"resolutionTime":267573},{"id":5,"count":4,"percent":4.166666666666666,"resolutionTime":42776},{"id":4,"count":3,"percent":3.125,"resolutionTime":403874}]}}' http_version: - recorded_at: Thu, 13 Dec 2018 12:49:05 GMT + recorded_at: Wed, 11 Sep 2019 15:02:24 GMT - request: method: get - uri: https://api.helpscout.net/v2/reports/conversations?end=2018-01-01T00:00:00Z&start=2017-12-01T00:00:00Z + uri: https://api.helpscout.net/v2/reports/productivity?end=2018-01-01T00:00:00Z&mailboxes=9999&start=2017-12-01T00:00:00Z body: encoding: US-ASCII string: '' @@ -102,7 +101,7 @@ http_interactions: User-Agent: - demarches-simplifiees.fr Authorization: - - Bearer 18mock9b + - Bearer redacted Content-Type: - application/json; charset=UTF-8 Expect: @@ -119,9 +118,9 @@ http_interactions: Content-Type: - application/json;charset=UTF-8 Correlation-Id: - - 9b1a2413-9d2a-4605-9791-b191ea62b838#53820636 + - aa56c5ae-9e2c-45c0-8af1-e344e6172af5#3277423 Date: - - Thu, 13 Dec 2018 12:49:05 GMT + - Wed, 11 Sep 2019 15:02:24 GMT Expires: - '0' Pragma: @@ -132,19 +131,18 @@ http_interactions: X-Frame-Options: - DENY X-Ratelimit-Limit-Minute: - - '200' + - '400' X-Ratelimit-Remaining-Minute: - - '198' + - '398' X-Xss-Protection: - 1; mode=block Content-Length: - - '5622' + - '2581' Connection: - keep-alive body: - encoding: ASCII-8BIT - string: !binary |- - eyJyZXBsaWVzIjp7ImNvdW50IjoxNDEsInRvcCI6W3sibmFtZSI6Ik1hdXZhaXMgaW50ZXJsb2N1dGV1ciIsImlkIjo3MjczOTYsIm1haWxib3hJZCI6MTI1OTI2LCJjb3VudCI6MTYsInBlcmNlbnQiOjExLjM0NzUxNzczMDQ5NjQ1NH0seyJuYW1lIjoiRGVtYW5kZSBjb21wdGUgYWRtaW4gcGFydGljdWxpZXIgLyBlbnRyZXByaXNlIiwiaWQiOjc1MTEzMCwibWFpbGJveElkIjoxMjU5MjYsImNvdW50Ijo4LCJwZXJjZW50Ijo1LjY3Mzc1ODg2NTI0ODIyN30seyJuYW1lIjoiRGVtYW5kZSBkZSBkw6ltbywgc3RlcCAxIiwiaWQiOjczMjE5NCwibWFpbGJveElkIjoxMjU5MjYsImNvdW50Ijo1LCJwZXJjZW50IjozLjU0NjA5OTI5MDc4MDE0Mn0seyJuYW1lIjoiVXNhZ2VyIGluc2NyaXQgbidhcnJpdmUgcGFzIMOgIGTDqXBvc2VyIGRlIGRvc3NpZXIgW09MR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6eyJkYXkiOjUsImhvdXIiOjAsImNvdW50Ijo0MH0sImZpbHRlclRhZ3MiOltdLCJidXN5VGltZVN0YXJ0IjoxNCwiYnVzeVRpbWVFbmQiOjE2LCJjdXN0b21GaWVsZHMiOnsiZmllbGRzIjpbXSwiY291bnQiOjB9LCJjdXJyZW50Ijp7InN0YXJ0RGF0ZSI6IjIwMTctMTItMDFUMDA6MDA6MDBaIiwiZW5kRGF0ZSI6IjIwMTgtMDEtMDFUMDA6MDA6MDBaIiwidG90YWxDb252ZXJzYXRpb25zIjoxNDEsImNvbnZlcnNhdGlvbnNDcmVhdGVkIjoxMjYsIm5ld0NvbnZlcnNhdGlvbnMiOjEyNiwiY3VzdG9tZXJzIjoxMTIsIm1lc3NhZ2VzUmVjZWl2ZWQiOjE5NiwiY29udmVyc2F0aW9uc1BlckRheSI6NH0sInRhZ0lkcyI6WyIxIl19 + encoding: UTF-8 + string: '{"filterTags":[{"name":"administration","id":3745889}],"current":{"startDate":"2017-12-01T00:00:00Z","endDate":"2018-01-01T00:00:00Z","totalConversations":87,"resolutionTime":118563.57471264368,"repliesToResolve":1.6666666666666667,"responseTime":36175,"firstResponseTime":30167,"resolved":87,"resolvedOnFirstReply":55,"closed":122,"repliesSent":156,"handleTime":305,"percentResolvedOnFirstReply":63.2183908045977,"ratings":[],"newConversations":126,"messagesReceived":196,"createdInHS":16},"responseTime":{"count":93,"previousCount":0,"ranges":[{"id":1,"count":24,"percent":25.806451612903224},{"id":3,"count":14,"percent":15.053763440860216},{"id":2,"count":12,"percent":12.903225806451612},{"id":5,"count":9,"percent":9.67741935483871},{"id":4,"count":7,"percent":7.526881720430108},{"id":7,"count":7,"percent":7.526881720430108},{"id":10,"count":7,"percent":7.526881720430108},{"id":8,"count":6,"percent":6.451612903225806},{"id":9,"count":5,"percent":5.376344086021505},{"id":6,"count":2,"percent":2.1505376344086025}]},"handleTime":{"count":87,"previousCount":0,"ranges":[{"id":1,"count":36,"percent":41.37931034482759},{"id":3,"count":23,"percent":26.436781609195403},{"id":4,"count":10,"percent":11.494252873563218},{"id":5,"count":10,"percent":11.494252873563218},{"id":2,"count":8,"percent":9.195402298850574}]},"firstResponseTime":{"count":93,"previousCount":0,"ranges":[{"id":1,"count":29,"percent":31.182795698924732},{"id":2,"count":15,"percent":16.129032258064516},{"id":3,"count":11,"percent":11.827956989247312},{"id":8,"count":11,"percent":11.827956989247312},{"id":4,"count":7,"percent":7.526881720430108},{"id":5,"count":7,"percent":7.526881720430108},{"id":6,"count":5,"percent":5.376344086021505},{"id":10,"count":5,"percent":5.376344086021505},{"id":7,"count":2,"percent":2.1505376344086025},{"id":9,"count":1,"percent":1.0752688172043012}]},"resolutionTime":{"count":87,"previousCount":0,"ranges":[{"id":1,"count":57,"percent":65.51724137931035},{"id":2,"count":13,"percent":14.942528735632186},{"id":5,"count":9,"percent":10.344827586206897},{"id":4,"count":5,"percent":5.747126436781609},{"id":3,"count":3,"percent":3.4482758620689653}]},"repliesToResolve":{"count":87,"previousCount":0,"ranges":[{"id":1,"count":55,"percent":63.2183908045977,"resolutionTime":14733},{"id":2,"count":22,"percent":25.287356321839084,"resolutionTime":184942},{"id":5,"count":5,"percent":5.747126436781609,"resolutionTime":632232},{"id":3,"count":4,"percent":4.597701149425287,"resolutionTime":564288},{"id":4,"count":1,"percent":1.1494252873563218,"resolutionTime":17641}]}}' http_version: - recorded_at: Thu, 13 Dec 2018 12:49:05 GMT + recorded_at: Wed, 11 Sep 2019 15:02:24 GMT recorded_with: VCR 4.0.0 diff --git a/spec/lib/helpscout/user_conversations_adapter_spec.rb b/spec/lib/helpscout/user_conversations_adapter_spec.rb index 7978bbb54..980fd7d21 100644 --- a/spec/lib/helpscout/user_conversations_adapter_spec.rb +++ b/spec/lib/helpscout/user_conversations_adapter_spec.rb @@ -15,9 +15,7 @@ describe Helpscout::UserConversationsAdapter do context 'when all required secrets are present' do before do - Rails.application.secrets.helpscout[:mailbox_id] = '9999' - Rails.application.secrets.helpscout[:client_id] = '1234' - Rails.application.secrets.helpscout[:client_secret] = '5678' + mock_helpscout_secrets end it { expect(described_class.new(from, to).can_fetch_reports?).to be true } @@ -25,7 +23,10 @@ describe Helpscout::UserConversationsAdapter do end describe '#reports', vcr: { cassette_name: 'helpscout_conversations_reports' } do - before { Rails.cache.clear } + before do + mock_helpscout_secrets + Rails.cache.clear + end subject { described_class.new(from, to) } @@ -34,13 +35,19 @@ describe Helpscout::UserConversationsAdapter do end it 'populates each report with data' do - expect(subject.reports.first[:conversations_count]).to be > 0 + expect(subject.reports.first[:replies_sent]).to be > 0 expect(subject.reports.first[:start_date]).to eq Time.utc(2017, 11) expect(subject.reports.first[:end_date]).to eq Time.utc(2017, 12) - expect(subject.reports.last[:conversations_count]).to be > 0 + expect(subject.reports.last[:replies_sent]).to be > 0 expect(subject.reports.last[:start_date]).to eq Time.utc(2017, 12) expect(subject.reports.last[:end_date]).to eq Time.utc(2018, 01) end end + + def mock_helpscout_secrets + Rails.application.secrets.helpscout[:mailbox_id] = '9999' + Rails.application.secrets.helpscout[:client_id] = '1234' + Rails.application.secrets.helpscout[:client_secret] = '5678' + end end From 82bef0f651a8086397bd12da28ee1625940fc610 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 11 Sep 2019 20:49:35 +0200 Subject: [PATCH 5/5] use notifications_per_procedure properly --- app/views/instructeurs/procedures/index.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/instructeurs/procedures/index.html.haml b/app/views/instructeurs/procedures/index.html.haml index af971bf01..95c8341a0 100644 --- a/app/views/instructeurs/procedures/index.html.haml +++ b/app/views/instructeurs/procedures/index.html.haml @@ -27,7 +27,7 @@ %li %object = link_to(instructeur_procedure_path(p, statut: 'suivis')) do - - if current_instructeur.notifications_per_procedure[p.defaut_groupe_instructeur.id].present? + - if current_instructeur.notifications_per_procedure[p.id].present? %span.notifications{ 'aria-label': "notifications" } - followed_count = @followed_dossiers_count_per_groupe_instructeur[p.defaut_groupe_instructeur.id] || 0 .stats-number @@ -37,7 +37,7 @@ %li %object = link_to(instructeur_procedure_path(p, statut: 'traites')) do - - if current_instructeur.notifications_per_procedure(:termine)[p.defaut_groupe_instructeur.id].present? + - if current_instructeur.notifications_per_procedure(:termine)[p.id].present? %span.notifications{ 'aria-label': "notifications" } - termines_count = @dossiers_termines_count_per_groupe_instructeur[p.defaut_groupe_instructeur.id] || 0 .stats-number