Last active
August 29, 2015 14:22
-
-
Save jklein/43b328977efbf4b1ed05 to your computer and use it in GitHub Desktop.
API Prod / Registrations diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only in /Users/jonathanklein/development/api/: .editorconfig | |
Only in /Users/jonathanklein/development/api/: .git | |
Only in /Users/jonathanklein/development/api/: .gitignore | |
diff -r ./Gemfile /Users/jonathanklein/development/api/Gemfile | |
5d4 | |
< gem 'rails', '4.1.1' | |
8c7 | |
< gem 'capistrano', '3.2.1' | |
--- | |
> gem 'capistrano', '3.4.0' | |
10,11c9,10 | |
< gem 'capistrano-rails', '~> 1.1' | |
< gem 'capistrano-bundler', '~> 1.1' | |
--- | |
> gem 'capistrano-rails', '1.1.3' | |
> gem 'capistrano-bundler', '1.1.4' | |
diff -r ./Gemfile.lock /Users/jonathanklein/development/api/Gemfile.lock | |
4,16d3 | |
< actionmailer (4.1.1) | |
< actionpack (= 4.1.1) | |
< actionview (= 4.1.1) | |
< mail (~> 2.5.4) | |
< actionpack (4.1.1) | |
< actionview (= 4.1.1) | |
< activesupport (= 4.1.1) | |
< rack (~> 1.5.2) | |
< rack-test (~> 0.6.2) | |
< actionview (4.1.1) | |
< activesupport (= 4.1.1) | |
< builder (~> 3.1) | |
< erubis (~> 2.7.0) | |
20,23d6 | |
< activerecord (4.1.1) | |
< activemodel (= 4.1.1) | |
< activesupport (= 4.1.1) | |
< arel (~> 5.0.0) | |
31d13 | |
< arel (5.0.1.20140414130214) | |
33c15 | |
< capistrano (3.2.1) | |
--- | |
> capistrano (3.4.0) | |
37c19 | |
< capistrano-bundler (1.1.3) | |
--- | |
> capistrano-bundler (1.1.4) | |
40c22 | |
< capistrano-rails (1.1.2) | |
--- | |
> capistrano-rails (1.1.3) | |
47d28 | |
< erubis (2.7.0) | |
50d30 | |
< hike (1.2.3) | |
54c34 | |
< httparty (0.13.4) | |
--- | |
> httparty (0.13.5) | |
57c37 | |
< i18n (0.6.11) | |
--- | |
> i18n (0.7.0) | |
59,61d38 | |
< mail (2.5.4) | |
< mime-types (~> 1.16) | |
< treetop (~> 1.4.8) | |
65d41 | |
< multi_json (1.10.1) | |
70c46 | |
< net-ssh (2.9.1) | |
--- | |
> net-ssh (2.9.2) | |
73d48 | |
< polyglot (0.3.5) | |
78,95d52 | |
< rack (1.5.2) | |
< rack-test (0.6.2) | |
< rack (>= 1.0) | |
< rails (4.1.1) | |
< actionmailer (= 4.1.1) | |
< actionpack (= 4.1.1) | |
< actionview (= 4.1.1) | |
< activemodel (= 4.1.1) | |
< activerecord (= 4.1.1) | |
< activesupport (= 4.1.1) | |
< bundler (>= 1.3.0, < 2.0) | |
< railties (= 4.1.1) | |
< sprockets-rails (~> 2.0) | |
< railties (4.1.1) | |
< actionpack (= 4.1.1) | |
< activesupport (= 4.1.1) | |
< rake (>= 0.8.7) | |
< thor (>= 0.18.1, < 2.0) | |
106,116c63,64 | |
< sprockets (2.12.3) | |
< hike (~> 1.2) | |
< multi_json (~> 1.0) | |
< rack (~> 1.0) | |
< tilt (~> 1.1, != 1.3.0) | |
< sprockets-rails (2.2.0) | |
< actionpack (>= 3.0) | |
< activesupport (>= 3.0) | |
< sprockets (>= 2.8, < 4.0) | |
< sshkit (1.5.1) | |
< colorize | |
--- | |
> sshkit (1.7.1) | |
> colorize (>= 0.7.0) | |
119d66 | |
< thor (0.19.1) | |
121,124d67 | |
< tilt (1.4.1) | |
< treetop (1.4.15) | |
< polyglot | |
< polyglot (>= 0.3.1) | |
133,135c76,78 | |
< capistrano (= 3.2.1) | |
< capistrano-bundler (~> 1.1) | |
< capistrano-rails (~> 1.1) | |
--- | |
> capistrano (= 3.4.0) | |
> capistrano-bundler (= 1.1.4) | |
> capistrano-rails (= 1.1.3) | |
143d85 | |
< rails (= 4.1.1) | |
Only in .: REVISION | |
Only in .: api_private_key_base: | |
Only in .: api_public_key_base: | |
diff -r ./application/controllers/contacts.php /Users/jonathanklein/development/api/application/controllers/contacts.php | |
417d416 | |
< $contact_arrays = array(); | |
421c420 | |
< | |
--- | |
> $added = 0; | |
425a425,428 | |
> $doAnotherBatch = true; | |
> $offset = 0; | |
> $batchSize = 1000; | |
> | |
427,428c430 | |
< $dup_list = ContactList::withID($data['import_id']); | |
< if($dup_list->account_id !== $this->account->id) $this->response(array('status' => false)); | |
--- | |
> while($doAnotherBatch){ | |
430,434c432 | |
< $potential_contacts = Contact::withListID($data['import_id']); | |
< } | |
< elseif($data['import_type'] == 'event'){ | |
< $event = Event::withID($data['import_id']); | |
< if($event->account_id !== $this->account->id) $this->response(array('status' => false)); | |
--- | |
> $doAnotherBatch = false; | |
436,440c434,436 | |
< $potential_contacts = Registration::withEventID($data['import_id']); | |
< } | |
< elseif($data['import_type'] == 'form'){ | |
< $form = Form::withID($data['import_id']); | |
< if($form->account_id !== $this->account->id) $this->response(array('status' => false)); | |
--- | |
> if($data['import_type'] == 'list'){ | |
> $dup_list = ContactList::withID($data['import_id']); | |
> if($dup_list->account_id !== $this->account->id) $this->response(array('status' => false)); | |
442,443c438 | |
< $potential_contacts = FormSubmission::withFormID($data['import_id']); | |
< } | |
--- | |
> $potential_contacts = Contact::withListID($data['import_id'], $batchSize, $offset); | |
445c440,443 | |
< foreach($potential_contacts as $inv){ | |
--- | |
> if(count($potential_contacts) >= $batchSize){ | |
> $doAnotherBatch = true; | |
> } | |
> } | |
447,449c445,449 | |
< if($inv->email == null){ | |
< $inv->email == ''; | |
< } | |
--- | |
> $allCounts = $this->add_potential_contacts($potential_contacts, $data['list_id'], $contact_emails, $contact_unique_values, true); | |
> $duplicate_count += $allCounts['duplicate_count']; | |
> $no_email_no_unique_value_count += $allCounts['no_email_no_unique_value_count']; | |
> $no_email_count += $allCounts['no_email_count']; | |
> $added += $allCounts['added']; | |
451,458c451 | |
< if(in_array($inv->email, $contact_emails) && $inv->email !== ''){ | |
< $duplicate_count++; | |
< continue; | |
< } | |
< if(in_array($inv->unique_value, $contact_unique_values) && $inv->unique_value !== '' && $inv->unique_value !== null){ | |
< $duplicate_count++; | |
< continue; | |
< } | |
--- | |
> $offset += $batchSize; | |
460,472c453,458 | |
< $contact = array( | |
< 'account_id' => $this->account->id, | |
< 'first_name' => $inv->first_name, | |
< 'list_id' => $data['list_id'], | |
< 'last_name' => $inv->last_name, | |
< 'unique_value' => $inv->unique_value, | |
< 'email' => $inv->email, | |
< 'hash' => md5($this->account->id.strtolower($inv->email).strtolower($inv->last_name).strtolower($inv->first_name)) | |
< ); | |
< | |
< array_push($contact_arrays, $contact); | |
< array_push($contact_emails, $inv->email); | |
< array_push($contact_unique_values, $inv->unique_value); | |
--- | |
> } | |
> } | |
> else{ | |
> if($data['import_type'] == 'event'){ | |
> $event = Event::withID($data['import_id']); | |
> if($event->account_id !== $this->account->id) $this->response(array('status' => false)); | |
474,475c460 | |
< if($inv->email == ''){ | |
< $no_email_count++; | |
--- | |
> $potential_contacts = Registration::withEventID($data['import_id']); | |
476a462,464 | |
> elseif($data['import_type'] == 'form'){ | |
> $form = Form::withID($data['import_id']); | |
> if($form->account_id !== $this->account->id) $this->response(array('status' => false)); | |
478,479c466 | |
< if($inv->email == '' && ($inv->unique_value == null || $inv->unique_value == '')){ | |
< $no_email_no_unique_value_count++; | |
--- | |
> $potential_contacts = FormSubmission::withFormID($data['import_id']); | |
481d467 | |
< } | |
483,490c469,473 | |
< /* | |
< * Save each contact | |
< */ | |
< $i=0; | |
< foreach($contact_arrays as $contact_data){ | |
< $contact = new Contact($contact_data); | |
< $contact->save(); | |
< $i++; | |
--- | |
> $allCounts = $this->add_potential_contacts($potential_contacts, $data['list_id'], $contact_emails, $contact_unique_values, false); | |
> $duplicate_count += $allCounts['duplicate_count']; | |
> $no_email_no_unique_value_count += $allCounts['no_email_no_unique_value_count']; | |
> $no_email_count += $allCounts['no_email_count']; | |
> $added += $allCounts['added']; | |
496c479 | |
< 'added' => $i, | |
--- | |
> 'added' => $added, | |
511a495,556 | |
> private function add_potential_contacts($potential_contacts, $list_id, $contact_emails, $contact_unique_values, $hasContactId){ | |
> $contact_arrays = array(); | |
> $allCounts = array( | |
> 'duplicate_count' => 0, | |
> 'no_email_no_unique_value_count' => 0, | |
> 'no_email_count' => 0 | |
> ); | |
> | |
> foreach($potential_contacts as $inv){ | |
> if($inv->email == null){ | |
> $inv->email == ''; | |
> } | |
> | |
> if(in_array($inv->email, $contact_emails) && $inv->email !== ''){ | |
> $allCounts['duplicate_count']++; | |
> continue; | |
> } | |
> if(in_array($inv->unique_value, $contact_unique_values) && $inv->unique_value !== '' && $inv->unique_value !== null){ | |
> $allCounts['duplicate_count']++; | |
> continue; | |
> } | |
> | |
> $contact = array( | |
> 'account_id' => $this->account->id, | |
> 'first_name' => $inv->first_name, | |
> 'list_id' => $list_id, | |
> 'last_name' => $inv->last_name, | |
> 'unique_value' => $inv->unique_value, | |
> 'email' => $inv->email, | |
> 'hash' => md5($this->account->id.strtolower($inv->email).strtolower($inv->last_name).strtolower($inv->first_name)) | |
> ); | |
> if($hasContactId){ | |
> $contact['id'] = $inv->id; | |
> } | |
> | |
> array_push($contact_arrays, $contact); | |
> array_push($contact_emails, $inv->email); | |
> array_push($contact_unique_values, $inv->unique_value); | |
> | |
> if($inv->email == ''){ | |
> $allCounts['no_email_count']++; | |
> } | |
> | |
> if($inv->email == '' && ($inv->unique_value == null || $inv->unique_value == '')){ | |
> $allCounts['no_email_no_unique_value_count']++; | |
> } | |
> } | |
> | |
> /* | |
> * Save each contact | |
> */ | |
> $i=0; | |
> foreach($contact_arrays as $contact_data){ | |
> $contact = new Contact($contact_data); | |
> $saved = $contact->save(); | |
> $i++; | |
> } | |
> | |
> $allCounts["added"] = $i; | |
> return $allCounts; | |
> } | |
> | |
diff -r ./application/libraries/domain/Contact.php /Users/jonathanklein/development/api/application/libraries/domain/Contact.php | |
174a175,176 | |
> $ci->db->limit($limit); | |
> $ci->db->offset($offset); | |
214c216 | |
< $contacts = Util::filterList($contacts, $limit, $offset, $order_by, $direction, $search_string); | |
--- | |
> $contacts = Util::filterList($contacts, $limit, 0, $order_by, $direction, $search_string); | |
323a326,327 | |
> $list_contact = new ListContact($list_id,$this->id); | |
> $list_contact->save(); | |
325c329,330 | |
< } else if ($status !== false) { | |
--- | |
> } | |
> else if ($status !== false) { | |
330c335,336 | |
< } else { | |
--- | |
> } | |
> else { | |
diff -r ./application/libraries/domain/Util.php /Users/jonathanklein/development/api/application/libraries/domain/Util.php | |
31,32c31 | |
< | |
< function cmp($a, $b) { | |
--- | |
> usort($items, function($a, $b) { | |
50c49 | |
< } | |
--- | |
> }); | |
52d50 | |
< usort($items, 'cmp'); | |
Only in /Users/jonathanklein/development/api/application/logs: api-20150601.log | |
Only in /Users/jonathanklein/development/api/application/logs: api-20150602.log | |
Only in /Users/jonathanklein/development/api/application/logs: api-20150603.log | |
Only in /Users/jonathanklein/development/api/application/logs: api-20150604.log | |
Only in /Users/jonathanklein/development/api/application/logs: api-20150605.log | |
diff -r ./config/capistrano/copy.rb /Users/jonathanklein/development/api/config/capistrano/copy.rb | |
6a7,10 | |
> # Since we aren't deploying from git, drop a version.txt into the directory | |
> # that contains the commit hash we are currently deploying | |
> sh "git rev-parse HEAD > version.txt" | |
> | |
diff -r ./config/deploy.rb /Users/jonathanklein/development/api/config/deploy.rb | |
1,2c1 | |
< # config valid only for Capistrano 3.1 | |
< lock '3.2.1' | |
--- | |
> lock '3.4.0' | |
16c15 | |
< set :repo_url, "[email protected]:AttendDotCom/attendware-api-prod.git" | |
--- | |
> set :repo_url, "[email protected]:AttendDotCom/api.git" | |
Only in .: database: | |
Only in .: development: | |
Only in .: end | |
Only in .: host: | |
Only in /Users/jonathanklein/development/api/: info.php | |
Only in .: listen | |
Only in .: password: | |
Only in .: pool: | |
Only in .: prod_api.tgz | |
Only in .: production: | |
Only in .: secret_key_base: | |
Only in .: staging: | |
Only in .: test: | |
Only in .: true | |
Only in .: username: | |
Only in /Users/jonathanklein/development/api/: vendor | |
Only in .: worker_processes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment