From fd2834f89e6a53df2d118b38cac82898625787ef Mon Sep 17 00:00:00 2001 From: Michael Volo Date: Thu, 7 Nov 2024 17:27:27 -0600 Subject: [PATCH] Revert "send language from book to salesforce" This reverts commit c4891fd8c9ad4f15cb1eb6242183553bf5540675. --- .../newflow/educator_signup/complete_profile.rb | 5 ++--- .../newflow/create_or_update_salesforce_lead.rb | 17 ++--------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/app/handlers/newflow/educator_signup/complete_profile.rb b/app/handlers/newflow/educator_signup/complete_profile.rb index 23fa19532..10b9d6456 100644 --- a/app/handlers/newflow/educator_signup/complete_profile.rb +++ b/app/handlers/newflow/educator_signup/complete_profile.rb @@ -138,9 +138,8 @@ def books_used end def books_used_details - puts signup_params[:books_used_details] - signup_params[:books_used_details].to_h.select do |_, v| - v['how_using_book'].present? && v['num_students_using_book'].present? + (signup_params.books_used_details || {}).reject do |k, v| + k.blank? || v.dig('how_using_book').blank? || v.dig('num_students_using_book').blank? end end diff --git a/app/routines/newflow/create_or_update_salesforce_lead.rb b/app/routines/newflow/create_or_update_salesforce_lead.rb index f78e29dfa..d186fc30a 100644 --- a/app/routines/newflow/create_or_update_salesforce_lead.rb +++ b/app/routines/newflow/create_or_update_salesforce_lead.rb @@ -146,24 +146,11 @@ def build_book_adoption_json_for_salesforce(user) return nil unless user.books_used_details user.books_used_details.each do |book| - - book_value = book[0] - if book_value.match(/\[.*\]/) - book_name = book_value.gsub(/\[.*\]/, '').strip # Calculus Volume 1 - book_language = book_value[/\[(.*?)\]/, 1] # Spanish (no brackets) - books_json << { - name: book_name, - students: book[1]["num_students_using_book"], - howUsing: book[1]["how_using_book"], - language: book_language, - } - else - books_json << { - name: book_value, + books_json << { + name: book[0], students: book[1]["num_students_using_book"], howUsing: book[1]["how_using_book"] } - end end adoption_json['Books'] = books_json