Skip to content

Commit

Permalink
send language with lead creation (#1280)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo authored Nov 11, 2024
1 parent a0685bc commit 3efaf8c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/routines/newflow/create_or_update_salesforce_lead.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,23 @@ def build_book_adoption_json_for_salesforce(user)
return nil unless user.books_used_details

user.books_used_details.each do |book|
books_json << {
name: book[0],
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,
students: book[1]["num_students_using_book"],
howUsing: book[1]["how_using_book"]
}
end
end

adoption_json['Books'] = books_json
Expand Down

0 comments on commit 3efaf8c

Please sign in to comment.