File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,23 @@ def build_book_adoption_json_for_salesforce(user)
146
146
return nil unless user . books_used_details
147
147
148
148
user . books_used_details . each do |book |
149
- books_json << {
150
- name : book [ 0 ] ,
149
+ book_value = book [ 0 ]
150
+ if book_value . match ( /\[ .*\] / )
151
+ book_name = book_value . gsub ( /\[ .*\] / , '' ) . strip # Calculus Volume 1
152
+ book_language = book_value [ /\[ (.*?)\] / , 1 ] # Spanish (no brackets)
153
+ books_json << {
154
+ name : book_name ,
155
+ students : book [ 1 ] [ "num_students_using_book" ] ,
156
+ howUsing : book [ 1 ] [ "how_using_book" ] ,
157
+ language : book_language ,
158
+ }
159
+ else
160
+ books_json << {
161
+ name : book_value ,
151
162
students : book [ 1 ] [ "num_students_using_book" ] ,
152
163
howUsing : book [ 1 ] [ "how_using_book" ]
153
164
}
165
+ end
154
166
end
155
167
156
168
adoption_json [ 'Books' ] = books_json
You can’t perform that action at this time.
0 commit comments