openstax_salesforce 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/openstax/salesforce/remote/tutor_course_period.rb +49 -0
- data/lib/openstax/salesforce/spec_helpers/salesforce_proxy.rb +3 -16
- data/lib/openstax/salesforce/version.rb +1 -1
- data/lib/openstax_salesforce.rb +1 -4
- data/spec/openstax/salesforce/remote/tutor_course_period_spec.rb +30 -0
- metadata +6 -9
- data/lib/openstax/salesforce/remote/class_size.rb +0 -57
- data/lib/openstax/salesforce/remote/individual_adoption.rb +0 -31
- data/lib/openstax/salesforce/remote/os_ancillary.rb +0 -103
- data/lib/openstax/salesforce/remote/tutor_onboarding_a.rb +0 -33
- data/spec/openstax/salesforce/remote/os_ancillary_spec.rb +0 -35
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 74d422ed32aa0879b27422340bad963cd7ca7cf1a7ae551d33d4deb24877a819
         | 
| 4 | 
            +
              data.tar.gz: 5e2c2d2ae2ee4cbb435f4392bd79068bef5154e9ad456a402f12a9b564ad1d38
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6a0becf88d28651d0bb0ba0239ce1c0584be4a4d7995a2804db9d2ec5a1e031c0c4d284cde749dc1f29b4840ae0b31f4c7ec887d380570833c128dc05a45a2bb
         | 
| 7 | 
            +
              data.tar.gz: e15359158438e0fe020a51747cc9916469f1eb96e40e40aecb8880f839b53557816ad2265aee2b235d0e8168051214db6102717ef04ac213b69dc8cecdd00a35
         | 
| @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            module OpenStax::Salesforce::Remote
         | 
| 2 | 
            +
              class TutorCoursePeriod < ActiveForce::SObject
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                field :num_teachers,              from: "Active_Teachers__c", as: :int
         | 
| 5 | 
            +
                field :base_year,                 from: "Base_Year__c", as: :int
         | 
| 6 | 
            +
                field :book_name,                 from: "Book_Name__c"
         | 
| 7 | 
            +
                field :contact_id,                from: "Contact__c"
         | 
| 8 | 
            +
                field :course_code,               from: "Course_Code__c"
         | 
| 9 | 
            +
                field :course_name,               from: "Course_Name__c"
         | 
| 10 | 
            +
                field :course_start_date,         from: "Course_Start_Date__c", as: :date
         | 
| 11 | 
            +
                field :created_at,                from: "E_Created_Date__c", as: :datetime
         | 
| 12 | 
            +
                field :teacher_email,             from: "Email__c"
         | 
| 13 | 
            +
                field :error,                     from: "Error__c"
         | 
| 14 | 
            +
                field :estimated_enrollment,      from: "Estimated_Enrollment__c", as: :int
         | 
| 15 | 
            +
                field :course_id,                 from: "External_ID__c"
         | 
| 16 | 
            +
                field :course_uuid,               from: "External_UUID__c"
         | 
| 17 | 
            +
                field :latest_adoption_decision,  from: "Latest_Adoption_Decision__c"
         | 
| 18 | 
            +
                field :does_cost,                 from: "Paid_Course__c", as: :boolean
         | 
| 19 | 
            +
                field :is_research,               from: "Research_Project__c", as: :boolean
         | 
| 20 | 
            +
                field :num_periods,               from: "Sections__c", as: :int
         | 
| 21 | 
            +
                field :status,                    from: "Status__c", as: :picklist
         | 
| 22 | 
            +
                field :num_students_comped,       from: "Students_Comped__c", as: :int
         | 
| 23 | 
            +
                field :num_students_dropped,      from: "Students_Dropped__c", as: :int
         | 
| 24 | 
            +
                field :num_students_paid,         from: "Students_Paid__c", as: :int
         | 
| 25 | 
            +
                field :num_students_refunded,     from: "Students_Refunded__c", as: :int
         | 
| 26 | 
            +
                field :num_students,              from: "Students_Using__c", as: :int
         | 
| 27 | 
            +
                field :num_students_with_work,    from: "Students_With_Work__c", as: :int
         | 
| 28 | 
            +
                field :period_uuid,               from: "Period_UUID__c"
         | 
| 29 | 
            +
                field :term,                      from: "Term__c"
         | 
| 30 | 
            +
                field :is_pilot,                  from: "Tutor_Pilot__c", as: :boolean
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                self.table_name = 'Tutor_Course__c'
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                def reset_stats
         | 
| 35 | 
            +
                  self.num_periods = 0
         | 
| 36 | 
            +
                  self.num_students = 0
         | 
| 37 | 
            +
                  self.num_students_comped = 0
         | 
| 38 | 
            +
                  self.num_students_dropped = 0
         | 
| 39 | 
            +
                  self.num_students_paid = 0
         | 
| 40 | 
            +
                  self.num_students_refunded = 0
         | 
| 41 | 
            +
                  self.num_students_with_work = 0
         | 
| 42 | 
            +
                  self.num_teachers = 0
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                STATUS_APPROVED = "Approved"
         | 
| 46 | 
            +
                STATUS_ARCHIVED = "ArchivedPeriod"
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
            end
         | 
| @@ -16,8 +16,7 @@ module OpenStax::Salesforce::SpecHelpers | |
| 16 16 | 
             
                end
         | 
| 17 17 |  | 
| 18 18 | 
             
                def new_contact(first_name: nil, last_name: nil, school_name: "JP University",
         | 
| 19 | 
            -
                                email: nil, email_alt: nil,
         | 
| 20 | 
            -
                                faculty_verified: nil)
         | 
| 19 | 
            +
                                email: nil, email_alt: nil, faculty_verified: nil, school_type: nil)
         | 
| 21 20 | 
             
                  ensure_schools_exist([school_name])
         | 
| 22 21 |  | 
| 23 22 | 
             
                  Contact.new(
         | 
| @@ -26,7 +25,8 @@ module OpenStax::Salesforce::SpecHelpers | |
| 26 25 | 
             
                    school_id: school_id(school_name),
         | 
| 27 26 | 
             
                    email: email,
         | 
| 28 27 | 
             
                    email_alt: email_alt,
         | 
| 29 | 
            -
                    faculty_verified: faculty_verified
         | 
| 28 | 
            +
                    faculty_verified: faculty_verified,
         | 
| 29 | 
            +
                    school_type: school_type
         | 
| 30 30 | 
             
                  ).tap do |contact|
         | 
| 31 31 | 
             
                    if !contact.save
         | 
| 32 32 | 
             
                      raise "Could not save SF contact: #{contact.errors}"
         | 
| @@ -48,19 +48,6 @@ module OpenStax::Salesforce::SpecHelpers | |
| 48 48 | 
             
                  end
         | 
| 49 49 | 
             
                end
         | 
| 50 50 |  | 
| 51 | 
            -
                def new_tutor_onboarding_a(first_teacher_contact_id: nil, pardot_reported_contact_id: nil)
         | 
| 52 | 
            -
                  raise "Not enough arguments given" if first_teacher_contact_id.nil? && pardot_reported_contact_id.nil?
         | 
| 53 | 
            -
             | 
| 54 | 
            -
                  TutorOnboardingA.new(
         | 
| 55 | 
            -
                    first_teacher_contact_id: first_teacher_contact_id,
         | 
| 56 | 
            -
                    pardot_reported_contact_id: pardot_reported_contact_id
         | 
| 57 | 
            -
                  ).tap do |toa|
         | 
| 58 | 
            -
                    if !toa.save
         | 
| 59 | 
            -
                      raise "Could not save SF TOA: #{toa.errors}"
         | 
| 60 | 
            -
                    end
         | 
| 61 | 
            -
                  end
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 51 | 
             
                def new_campaign(name: SecureRandom.hex(8))
         | 
| 65 52 | 
             
                  Campaign.new(
         | 
| 66 53 | 
             
                    name: name
         | 
    
        data/lib/openstax_salesforce.rb
    CHANGED
    
    | @@ -12,12 +12,9 @@ require "openstax/salesforce/remote/term_year" | |
| 12 12 | 
             
            require "openstax/salesforce/remote/book"
         | 
| 13 13 | 
             
            require "openstax/salesforce/remote/school"
         | 
| 14 14 | 
             
            require "openstax/salesforce/remote/opportunity"
         | 
| 15 | 
            -
            require "openstax/salesforce/remote/ | 
| 16 | 
            -
            require "openstax/salesforce/remote/class_size"
         | 
| 17 | 
            -
            require "openstax/salesforce/remote/os_ancillary"
         | 
| 15 | 
            +
            require "openstax/salesforce/remote/tutor_course_period"
         | 
| 18 16 | 
             
            require "openstax/salesforce/remote/contact"
         | 
| 19 17 | 
             
            require "openstax/salesforce/remote/lead"
         | 
| 20 | 
            -
            require "openstax/salesforce/remote/tutor_onboarding_a"
         | 
| 21 18 | 
             
            require "openstax/salesforce/remote/campaign"
         | 
| 22 19 | 
             
            require "openstax/salesforce/remote/campaign_member"
         | 
| 23 20 |  | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            require 'rails_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            RSpec.describe OpenStax::Salesforce::Remote::TutorCoursePeriod do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              subject { described_class.new }
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              it 'can reset stats' do
         | 
| 8 | 
            +
                subject.num_periods = 1
         | 
| 9 | 
            +
                subject.num_students = 8
         | 
| 10 | 
            +
                subject.num_students_comped = 7
         | 
| 11 | 
            +
                subject.num_students_dropped = 6
         | 
| 12 | 
            +
                subject.num_students_paid = 5
         | 
| 13 | 
            +
                subject.num_students_refunded = 4
         | 
| 14 | 
            +
                subject.num_students_with_work = 3
         | 
| 15 | 
            +
                subject.num_teachers = 2
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                subject.reset_stats
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                expect(subject.num_periods).to eq 0
         | 
| 20 | 
            +
                expect(subject.num_students).to eq 0
         | 
| 21 | 
            +
                expect(subject.num_students_comped).to eq 0
         | 
| 22 | 
            +
                expect(subject.num_students_dropped).to eq 0
         | 
| 23 | 
            +
                expect(subject.num_students_paid).to eq 0
         | 
| 24 | 
            +
                expect(subject.num_students_refunded).to eq 0
         | 
| 25 | 
            +
                expect(subject.num_students_paid).to eq 0
         | 
| 26 | 
            +
                expect(subject.num_students_with_work).to eq 0
         | 
| 27 | 
            +
                expect(subject.num_teachers).to eq 0
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: openstax_salesforce
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 2.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - JP Slavinsky
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-09-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -189,15 +189,12 @@ files: | |
| 189 189 | 
             
            - lib/openstax/salesforce/remote/book.rb
         | 
| 190 190 | 
             
            - lib/openstax/salesforce/remote/campaign.rb
         | 
| 191 191 | 
             
            - lib/openstax/salesforce/remote/campaign_member.rb
         | 
| 192 | 
            -
            - lib/openstax/salesforce/remote/class_size.rb
         | 
| 193 192 | 
             
            - lib/openstax/salesforce/remote/contact.rb
         | 
| 194 | 
            -
            - lib/openstax/salesforce/remote/individual_adoption.rb
         | 
| 195 193 | 
             
            - lib/openstax/salesforce/remote/lead.rb
         | 
| 196 194 | 
             
            - lib/openstax/salesforce/remote/opportunity.rb
         | 
| 197 | 
            -
            - lib/openstax/salesforce/remote/os_ancillary.rb
         | 
| 198 195 | 
             
            - lib/openstax/salesforce/remote/school.rb
         | 
| 199 196 | 
             
            - lib/openstax/salesforce/remote/term_year.rb
         | 
| 200 | 
            -
            - lib/openstax/salesforce/remote/ | 
| 197 | 
            +
            - lib/openstax/salesforce/remote/tutor_course_period.rb
         | 
| 201 198 | 
             
            - lib/openstax/salesforce/spec_helpers.rb
         | 
| 202 199 | 
             
            - lib/openstax/salesforce/spec_helpers/salesforce_proxy.rb
         | 
| 203 200 | 
             
            - lib/openstax/salesforce/user_missing.rb
         | 
| @@ -246,8 +243,8 @@ files: | |
| 246 243 | 
             
            - spec/openstax/salesforce/controllers/application_controller_spec.rb
         | 
| 247 244 | 
             
            - spec/openstax/salesforce/controllers/settings_controller_spec.rb
         | 
| 248 245 | 
             
            - spec/openstax/salesforce/remote/opportunity_spec.rb
         | 
| 249 | 
            -
            - spec/openstax/salesforce/remote/os_ancillary_spec.rb
         | 
| 250 246 | 
             
            - spec/openstax/salesforce/remote/term_year_spec.rb
         | 
| 247 | 
            +
            - spec/openstax/salesforce/remote/tutor_course_period_spec.rb
         | 
| 251 248 | 
             
            - spec/openstax/salesforce/spec_helpers_spec.rb
         | 
| 252 249 | 
             
            - spec/rails_helper.rb
         | 
| 253 250 | 
             
            - spec/routing_spec.rb
         | 
| @@ -272,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 272 269 | 
             
                  version: '0'
         | 
| 273 270 | 
             
            requirements: []
         | 
| 274 271 | 
             
            rubyforge_project: 
         | 
| 275 | 
            -
            rubygems_version: 2. | 
| 272 | 
            +
            rubygems_version: 2.7.3
         | 
| 276 273 | 
             
            signing_key: 
         | 
| 277 274 | 
             
            specification_version: 4
         | 
| 278 275 | 
             
            summary: Interface gem for accessing OpenStax's Salesforce instance
         | 
| @@ -319,9 +316,9 @@ test_files: | |
| 319 316 | 
             
            - spec/openstax/salesforce/spec_helpers_spec.rb
         | 
| 320 317 | 
             
            - spec/openstax/salesforce/controllers/settings_controller_spec.rb
         | 
| 321 318 | 
             
            - spec/openstax/salesforce/controllers/application_controller_spec.rb
         | 
| 322 | 
            -
            - spec/openstax/salesforce/remote/os_ancillary_spec.rb
         | 
| 323 319 | 
             
            - spec/openstax/salesforce/remote/term_year_spec.rb
         | 
| 324 320 | 
             
            - spec/openstax/salesforce/remote/opportunity_spec.rb
         | 
| 321 | 
            +
            - spec/openstax/salesforce/remote/tutor_course_period_spec.rb
         | 
| 325 322 | 
             
            - spec/factories/user.rb
         | 
| 326 323 | 
             
            - spec/routing_spec.rb
         | 
| 327 324 | 
             
            - spec/rails_helper.rb
         | 
| @@ -1,57 +0,0 @@ | |
| 1 | 
            -
            module OpenStax::Salesforce::Remote
         | 
| 2 | 
            -
              class ClassSize < ActiveForce::SObject
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                field :concept_coach_approved,    from: "Concept_Coach_Approved__c", as: :boolean
         | 
| 5 | 
            -
                field :course_name,               from: "Course_Name__c"
         | 
| 6 | 
            -
                field :course_id,                 from: "Tutor_ID__c"
         | 
| 7 | 
            -
                field :created_at,                from: "Tutor_Created_Date__c", as: :datetime
         | 
| 8 | 
            -
                field :num_students,              from: "Student_using_Tutor__c", as: :int
         | 
| 9 | 
            -
                field :num_teachers,              from: "Active_Teachers__c", as: :int
         | 
| 10 | 
            -
                field :num_sections,              from: "Number_of_Sections__c", as: :int
         | 
| 11 | 
            -
                field :teacher_join_url,          from: "Teacher_Join_URL__c"
         | 
| 12 | 
            -
                field :error,                     from: "Tutor_Error__c"
         | 
| 13 | 
            -
                field :book_name,                 from: "Book_Name__c"
         | 
| 14 | 
            -
                field :school,                    from: "School__c"
         | 
| 15 | 
            -
                field :term_year,                 from: "TermYear__c"
         | 
| 16 | 
            -
                field :opportunity_id,            from: 'Opportunity__c'
         | 
| 17 | 
            -
                field :os_ancillary_id,           from: "OSA__c"
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                belongs_to :opportunity, model: OpenStax::Salesforce::Remote::Opportunity
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                self.table_name = 'Class_Size__c'
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                def term_year_object
         | 
| 24 | 
            -
                  @term_year_object ||= OpenStax::Salesforce::Remote::TermYear.from_string(self.term_year)
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                def reset_stats
         | 
| 28 | 
            -
                  self.num_students = 0
         | 
| 29 | 
            -
                  self.num_teachers = 0
         | 
| 30 | 
            -
                  self.num_sections = 0
         | 
| 31 | 
            -
                end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                # Methods to make this legacy SF object compatible with current OsAncillary interface.
         | 
| 34 | 
            -
                # All ClassSize records were used for college CC courses.
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                def is_tutor?
         | 
| 37 | 
            -
                  false
         | 
| 38 | 
            -
                end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                def is_concept_coach?
         | 
| 41 | 
            -
                  true
         | 
| 42 | 
            -
                end
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                def valid_product?
         | 
| 45 | 
            -
                  true
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                def is_college?
         | 
| 49 | 
            -
                  true
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                def product
         | 
| 53 | 
            -
                  "Concept Coach"
         | 
| 54 | 
            -
                end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
              end
         | 
| 57 | 
            -
            end
         | 
| @@ -1,31 +0,0 @@ | |
| 1 | 
            -
            module OpenStax::Salesforce::Remote
         | 
| 2 | 
            -
              class IndividualAdoption < ActiveForce::SObject
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                field :book_name,                    from: "Book_Text__c"
         | 
| 5 | 
            -
                field :contact_id,                   from: "Contact__c"
         | 
| 6 | 
            -
                field :book_id,                      from: "Book__c"
         | 
| 7 | 
            -
                field :school_id,                    from: "Account__c"
         | 
| 8 | 
            -
                field :school_year,                  from: "School_Year__c"
         | 
| 9 | 
            -
                field :fall_start_date,              from: "Fall_Start_Date__c"
         | 
| 10 | 
            -
                field :summer_start_date,            from: "Summer_Start_Date__c"
         | 
| 11 | 
            -
                field :winter_start_date,            from: "Winter_Start_Date__c"
         | 
| 12 | 
            -
                field :spring_start_date,            from: "Spring_Start_Date__c"
         | 
| 13 | 
            -
                field :adoption_level,               from: "Adoption_Level__c"
         | 
| 14 | 
            -
                field :description,                  from: "Description__c"
         | 
| 15 | 
            -
                field :source,                       from: "Source__c"
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                # Deprecated
         | 
| 18 | 
            -
                field :term_year,                    from: "TermYear__c"
         | 
| 19 | 
            -
                field :class_start_date,             from: "Class_Start_Date__c"
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                belongs_to :school, model: OpenStax::Salesforce::Remote::School
         | 
| 22 | 
            -
                belongs_to :book, model: OpenStax::Salesforce::Remote::Book
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                self.table_name = 'Individual_Adoption__c'
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                def term_year_object
         | 
| 27 | 
            -
                  @term_year_object ||= OpenStax::Salesforce::Remote::TermYear.from_string(term_year)
         | 
| 28 | 
            -
                end
         | 
| 29 | 
            -
             | 
| 30 | 
            -
              end
         | 
| 31 | 
            -
            end
         | 
| @@ -1,103 +0,0 @@ | |
| 1 | 
            -
            module OpenStax::Salesforce::Remote
         | 
| 2 | 
            -
              class OsAncillary < ActiveForce::SObject
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                field :status,                    from: "Status__c", as: :picklist
         | 
| 5 | 
            -
                field :product,                   from: "Product__c", as: :picklist
         | 
| 6 | 
            -
                field :account_type,              from: "Account_Type__c"
         | 
| 7 | 
            -
                field :book_name,                 from: "Book_Name__c"
         | 
| 8 | 
            -
                field :course_start_date,         from: "Course_Start_Date__c", as: :date
         | 
| 9 | 
            -
                field :course_name,               from: "Course_Name__c"
         | 
| 10 | 
            -
                field :course_code,               from: "Course_Code__c"
         | 
| 11 | 
            -
                field :course_id,                 from: "External_ID__c"
         | 
| 12 | 
            -
                field :course_uuid,               from: "External_UUID__c"
         | 
| 13 | 
            -
                field :created_at,                from: "E_Created_Date__c", as: :datetime
         | 
| 14 | 
            -
                field :error,                     from: "Error__c"
         | 
| 15 | 
            -
                field :general_access_url,        from: "General_Access_URL__c"
         | 
| 16 | 
            -
                field :teacher_join_url,          from: "Teacher_Join_URL__c"
         | 
| 17 | 
            -
                field :school,                    from: "School_Name__c"
         | 
| 18 | 
            -
                field :num_teachers,              from: "Active_Teachers__c", as: :int
         | 
| 19 | 
            -
                field :num_sections,              from: "Sections__c", as: :int
         | 
| 20 | 
            -
                field :num_students,              from: "Students_Using__c", as: :int
         | 
| 21 | 
            -
                field :num_students_paid,         from: "Students_Paid__c", as: :int
         | 
| 22 | 
            -
                field :num_students_comped,       from: "Students_Comped__c", as: :int
         | 
| 23 | 
            -
                field :num_students_refunded,     from: "Students_Refunded__c", as: :int
         | 
| 24 | 
            -
                field :num_students_dropped,      from: "Students_Dropped__c", as: :int
         | 
| 25 | 
            -
                field :num_students_with_work,    from: "Students_With_Work__c", as: :int
         | 
| 26 | 
            -
                field :term_year,                 from: "TermYear__c"
         | 
| 27 | 
            -
                field :term,                      from: "Term__c"
         | 
| 28 | 
            -
                field :base_year,                 from: "Manual_Base_Year__c", as: :int
         | 
| 29 | 
            -
                field :estimated_enrollment,      from: "Estimated_Enrollment__c", as: :int
         | 
| 30 | 
            -
                field :does_cost,                 from: "Paid_Course__c", as: :boolean
         | 
| 31 | 
            -
                field :opportunity_id,            from: 'Opportunity__c'
         | 
| 32 | 
            -
                field :individual_adoption_id,    from: "Individual_Adoption__c"
         | 
| 33 | 
            -
                field :contact_id,                from: "Contact__c"
         | 
| 34 | 
            -
                field :campaign_member_id,        from: "Campaign_Member_ID__c"
         | 
| 35 | 
            -
                field :latest_adoption_decision,  from: "latest_adoption_decision__c"
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                belongs_to :opportunity, model: OpenStax::Salesforce::Remote::Opportunity
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                self.table_name = 'OS_Ancillary__c'
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                def reset_stats
         | 
| 42 | 
            -
                  self.num_students = 0
         | 
| 43 | 
            -
                  self.num_students_paid = 0
         | 
| 44 | 
            -
                  self.num_students_comped = 0
         | 
| 45 | 
            -
                  self.num_students_refunded = 0
         | 
| 46 | 
            -
                  self.num_students_dropped = 0
         | 
| 47 | 
            -
                  self.num_students_with_work = 0
         | 
| 48 | 
            -
                  self.num_teachers = 0
         | 
| 49 | 
            -
                  self.num_sections = 0
         | 
| 50 | 
            -
                end
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                def is_concept_coach?
         | 
| 53 | 
            -
                  "Concept Coach" == product
         | 
| 54 | 
            -
                end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                def is_tutor?
         | 
| 57 | 
            -
                  "Tutor" == product
         | 
| 58 | 
            -
                end
         | 
| 59 | 
            -
             | 
| 60 | 
            -
                def valid_product?
         | 
| 61 | 
            -
                  ["Tutor", "Concept Coach"].include?(product)
         | 
| 62 | 
            -
                end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                def term_year_object
         | 
| 65 | 
            -
                  @term_year_object ||= OpenStax::Salesforce::Remote::TermYear.from_string(self.term_year)
         | 
| 66 | 
            -
                end
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                def is_college?
         | 
| 69 | 
            -
                  # Seems like college account types are more likely to be added to
         | 
| 70 | 
            -
                  # more than high school types, so match non college types and negate
         | 
| 71 | 
            -
                  !NON_COLLEGE_ACCOUNT_TYPES.include?(account_type)
         | 
| 72 | 
            -
                end
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                # TODO warn somewhere if come across unknown account type
         | 
| 75 | 
            -
                def known_account_type?
         | 
| 76 | 
            -
                  ACCOUNT_TYPES.include(account_type)
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                NON_COLLEGE_ACCOUNT_TYPES = [
         | 
| 80 | 
            -
                  "High School",
         | 
| 81 | 
            -
                  "Elementary School",
         | 
| 82 | 
            -
                  "Middle/Junior High School",
         | 
| 83 | 
            -
                  "K-12 School"
         | 
| 84 | 
            -
                ]
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                # Unused, here for posterity
         | 
| 87 | 
            -
                COLLEGE_ACCOUNT_TYPES = [
         | 
| 88 | 
            -
                  "College/University (4)",
         | 
| 89 | 
            -
                  "Technical/Community College (2)",
         | 
| 90 | 
            -
                  "Career School/For-Profit (2)",
         | 
| 91 | 
            -
                  "For-Profit Tutoring",
         | 
| 92 | 
            -
                ]
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                ACCOUNT_TYPES = [
         | 
| 95 | 
            -
                  COLLEGE_ACCOUNT_TYPES,
         | 
| 96 | 
            -
                  NON_COLLEGE_ACCOUNT_TYPES,
         | 
| 97 | 
            -
                  "Other"
         | 
| 98 | 
            -
                ].flatten
         | 
| 99 | 
            -
             | 
| 100 | 
            -
                STATUS_APPROVED = "Approved"
         | 
| 101 | 
            -
             | 
| 102 | 
            -
              end
         | 
| 103 | 
            -
            end
         | 
| @@ -1,33 +0,0 @@ | |
| 1 | 
            -
            module OpenStax::Salesforce::Remote
         | 
| 2 | 
            -
              class TutorOnboardingA < ActiveForce::SObject
         | 
| 3 | 
            -
             | 
| 4 | 
            -
                field :accounts_uuid,                                     from: "accounts_uuid__c"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                field :contact_id,                                        from: "Contact__c"
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                field :pardot_reported_contact_id,                        from: "pardot_reported_contact_id__c"
         | 
| 9 | 
            -
                field :pardot_reported_piaid,                             from: "pardot_reported_piaid__c"
         | 
| 10 | 
            -
                field :pardot_reported_picid,                             from: "pardot_reported_picid__c"
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                field :first_teacher_contact_id,                          from: "first_teacher_contact_id__c"
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                field :arrived_marketing_page_from_pardot_at,             from: "arrived_marketing_page_from_pardot_at__c",    as: :datetime
         | 
| 15 | 
            -
                field :days_since_arrived_marketing_page_from_pardot,     from: "days_since_arrived_marketing_page_from_p__c", as: :double
         | 
| 16 | 
            -
                field :arrived_marketing_page_not_from_pardot_at,         from: "arrived_marketing_page_not_from_pardot_a__c", as: :datetime
         | 
| 17 | 
            -
                field :days_since_arrived_marketing_page_not_from_pardot, from: "days_since_arrived_marketing_page_from_p__c", as: :double
         | 
| 18 | 
            -
                field :preview_created_at,                                from: "preview_created_at__c",                       as: :datetime
         | 
| 19 | 
            -
                field :real_course_created_at,                            from: "real_course_created_at__c",                   as: :datetime
         | 
| 20 | 
            -
                field :like_preview_ask_later_count,                      from: "like_preview_ask_later_count__c",             as: :int
         | 
| 21 | 
            -
                field :like_preview_yes_at,                               from: "like_preview_yes_at__c",                      as: :datetime
         | 
| 22 | 
            -
                field :days_since_like_preview_yes,                       from: "days_since_like_preview_yes__c",              as: :double
         | 
| 23 | 
            -
                field :latest_adoption_decision,                          from: "latest_adoption_decision__c",                 as: :picklist
         | 
| 24 | 
            -
                field :latest_adoption_decision_at,                       from: "latest_adoption_decision_at__c",              as: :datetime
         | 
| 25 | 
            -
             | 
| 26 | 
            -
                belongs_to :contact, model: OpenStax::Salesforce::Remote::Contact
         | 
| 27 | 
            -
                belongs_to :first_teacher_contact, model: OpenStax::Salesforce::Remote::Contact
         | 
| 28 | 
            -
                belongs_to :pardot_reported_contact, model: OpenStax::Salesforce::Remote::Contact
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                self.table_name = 'TutorOnboardingA__c'
         | 
| 31 | 
            -
             | 
| 32 | 
            -
              end
         | 
| 33 | 
            -
            end
         | 
| @@ -1,35 +0,0 @@ | |
| 1 | 
            -
            require 'rails_helper'
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            RSpec.describe OpenStax::Salesforce::Remote::OsAncillary do
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              context 'when product is Concept Coach' do
         | 
| 6 | 
            -
                subject { described_class.new(product: "Concept Coach") }
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                it { is_expected.to be_is_concept_coach }
         | 
| 9 | 
            -
                it { is_expected.not_to be_is_tutor }
         | 
| 10 | 
            -
                it { is_expected.to be_valid_product }
         | 
| 11 | 
            -
              end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              context 'when product is Tutor' do
         | 
| 14 | 
            -
                subject { described_class.new(product: "Tutor") }
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                it { is_expected.not_to be_is_concept_coach }
         | 
| 17 | 
            -
                it { is_expected.to be_is_tutor }
         | 
| 18 | 
            -
                it { is_expected.to be_valid_product }
         | 
| 19 | 
            -
              end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
              context 'when product is nil' do
         | 
| 22 | 
            -
                subject { described_class.new }
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                it { is_expected.not_to be_is_concept_coach }
         | 
| 25 | 
            -
                it { is_expected.not_to be_is_tutor }
         | 
| 26 | 
            -
                it { is_expected.not_to be_valid_product }
         | 
| 27 | 
            -
              end
         | 
| 28 | 
            -
             | 
| 29 | 
            -
              it 'knows which account types are for college' do
         | 
| 30 | 
            -
                described_class::COLLEGE_ACCOUNT_TYPES.each do |college_type|
         | 
| 31 | 
            -
                  expect(described_class.new(account_type: college_type)).to be_is_college
         | 
| 32 | 
            -
                end
         | 
| 33 | 
            -
              end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            end
         |