coalescing_panda 3.1.6 → 3.1.7
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 +4 -4
 - data/app/models/coalescing_panda/workers/course_miner.rb +17 -13
 - data/db/migrate/20141120153135_create_coalescing_panda_enrollments.rb +1 -1
 - data/lib/coalescing_panda/version.rb +1 -1
 - data/spec/dummy/log/test.log +2942 -0
 - data/spec/models/coalescing_panda/enrollment_spec.rb +4 -4
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c1a2b3a8674dec25da996c1866559dce5c54c2be
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b113be1e2d2f65f5edc83baa2caad47b8ecd715a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 17516c2dc82500c1d16d436c06a0feb3615596f9db52346dba38bf6a6716cafbbc51a4f2f561974d438e9ad0f6acf08a655a0ca96ec4181702a844d6a64a01f6
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: aa2658a9df94373c36f20bc38281aec07d8b8793cdaa5ecd749c1531e086df3a55ce12571be866eb6b9ac92036ce53c708d4995a48135748c9396be811d49f4f
         
     | 
| 
         @@ -65,20 +65,24 @@ class CoalescingPanda::Workers::CourseMiner 
     | 
|
| 
       65 
65 
     | 
    
         
             
              def create_records(collection, model_key)
         
     | 
| 
       66 
66 
     | 
    
         
             
                model = "CoalescingPanda::#{model_key.to_s.singularize.titleize}".constantize
         
     | 
| 
       67 
67 
     | 
    
         
             
                collection.each do |values|
         
     | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                     
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                     
     | 
| 
      
 68 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 69 
     | 
    
         
            +
                    canvas_id_key = "canvas_#{model_key.to_s.singularize}_id"
         
     | 
| 
      
 70 
     | 
    
         
            +
                    values[canvas_id_key] = values["id"]
         
     | 
| 
      
 71 
     | 
    
         
            +
                    values['workflow_state'] = values["enrollment_state"] if values.has_key?('enrollment_state')
         
     | 
| 
      
 72 
     | 
    
         
            +
                    values['enrollment_type'] = values['type'] if model_key == :enrollments
         
     | 
| 
      
 73 
     | 
    
         
            +
                    if model_key == :users
         
     | 
| 
      
 74 
     | 
    
         
            +
                      record = account.send(model_key).where("#{canvas_id_key} = ?", values['id'].to_s).first_or_initialize
         
     | 
| 
      
 75 
     | 
    
         
            +
                    else
         
     | 
| 
      
 76 
     | 
    
         
            +
                      record = course.send(model_key).where("#{canvas_id_key} = ?", values['id'].to_s).first_or_initialize
         
     | 
| 
      
 77 
     | 
    
         
            +
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
                    record.coalescing_panda_lti_account_id = account.id if record.respond_to?(:coalescing_panda_lti_account_id)
         
     | 
| 
      
 79 
     | 
    
         
            +
                    record.assign_attributes(standard_attributes(record, values))
         
     | 
| 
      
 80 
     | 
    
         
            +
                    record.sis_id = sis_id(model_key, values) if record.respond_to?(:sis_id)
         
     | 
| 
      
 81 
     | 
    
         
            +
                    create_associations(record, model_key, values)
         
     | 
| 
      
 82 
     | 
    
         
            +
                    record.save(validate: false)
         
     | 
| 
      
 83 
     | 
    
         
            +
                  rescue => e
         
     | 
| 
      
 84 
     | 
    
         
            +
                    logger.info("#{model} not created: Batch: #{batch.id}, Message: #{e.message}, values: #{values}")
         
     | 
| 
       76 
85 
     | 
    
         
             
                  end
         
     | 
| 
       77 
     | 
    
         
            -
                  record.coalescing_panda_lti_account_id = account.id if record.respond_to?(:coalescing_panda_lti_account_id)
         
     | 
| 
       78 
     | 
    
         
            -
                  record.assign_attributes(standard_attributes(record, values))
         
     | 
| 
       79 
     | 
    
         
            -
                  record.sis_id = sis_id(model_key, values) if record.respond_to?(:sis_id)
         
     | 
| 
       80 
     | 
    
         
            -
                  create_associations(record, model_key, values)
         
     | 
| 
       81 
     | 
    
         
            -
                  record.save(validate: false)
         
     | 
| 
       82 
86 
     | 
    
         
             
                end
         
     | 
| 
       83 
87 
     | 
    
         
             
              end
         
     | 
| 
       84 
88 
     | 
    
         | 
| 
         @@ -13,7 +13,7 @@ class CreateCoalescingPandaEnrollments < ActiveRecord::Migration 
     | 
|
| 
       13 
13 
     | 
    
         
             
                  t.timestamps
         
     | 
| 
       14 
14 
     | 
    
         
             
                end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                add_index :coalescing_panda_enrollments, [:coalescing_panda_user_id, :coalescing_panda_section_id, :enrollment_type], name: : 
     | 
| 
      
 16 
     | 
    
         
            +
                add_index :coalescing_panda_enrollments, [:coalescing_panda_user_id, :coalescing_panda_section_id, :enrollment_type], name: :index_enrollments_user_and_section, unique: true
         
     | 
| 
       17 
17 
     | 
    
         
             
                add_index :coalescing_panda_enrollments, :sis_id
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         
             
            end
         
     |