From 027456105bb797f7fab8ca7113dbfc048d898ed6 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 29 Jul 2014 18:11:00 -0500 Subject: [PATCH] * VRFS-1968 - locids are now in score history --- db/manifest | 3 ++- db/up/locidispid_in_score_histories.sql | 5 +++++ ruby/lib/jam_ruby/models/score_history.rb | 6 ++++-- ruby/spec/jam_ruby/models/score_history_spec.rb | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 db/up/locidispid_in_score_histories.sql diff --git a/db/manifest b/db/manifest index 76f231c5a..8bad4f17c 100755 --- a/db/manifest +++ b/db/manifest @@ -198,4 +198,5 @@ connection_allow_null_locidispid.sql track_user_in_scores.sql median_aggregate.sql current_scores_use_median.sql -current_scores_ams_index_sms_index_use_user_instrument.sql \ No newline at end of file +current_scores_ams_index_sms_index_use_user_instrument.sql +locidispid_in_score_histories.sql \ No newline at end of file diff --git a/db/up/locidispid_in_score_histories.sql b/db/up/locidispid_in_score_histories.sql new file mode 100644 index 000000000..38846045b --- /dev/null +++ b/db/up/locidispid_in_score_histories.sql @@ -0,0 +1,5 @@ +-- https://jamkazam.atlassian.net/browse/VRFS-1968 +-- store both locids in score_histories + +ALTER TABLE score_histories ADD COLUMN from_locidispid BIGINT NOT NULL; +ALTER TABLE score_histories ADD COLUMN to_locidispid BIGINT NOT NULL; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/score_history.rb b/ruby/lib/jam_ruby/models/score_history.rb index ed90892d4..4c82e3326 100644 --- a/ruby/lib/jam_ruby/models/score_history.rb +++ b/ruby/lib/jam_ruby/models/score_history.rb @@ -15,14 +15,15 @@ module JamRuby result = connection.execute( "INSERT INTO score_histories - (from_client_id, from_user_id, from_latency_tester_id, from_addr, from_isp, from_country, from_region, from_city, from_postal, from_latitude, from_longitude, - to_client_id, to_user_id, to_latency_tester_id, to_addr, to_isp, to_country, to_region, to_city, to_postal, to_latitude, to_longitude, + (from_client_id, from_user_id, from_latency_tester_id, from_addr, from_locidispid, from_isp, from_country, from_region, from_city, from_postal, from_latitude, from_longitude, + to_client_id, to_user_id, to_latency_tester_id, to_addr, to_locidispid, to_isp, to_country, to_region, to_city, to_postal, to_latitude, to_longitude, score, score_dt, scoring_data) SELECT s.anodeid AS from_client_id, s.auserid AS from_user_id, s.alatencytestid AS from_latency_tester_id, s.aaddr AS from_addr, + s.alocidispid AS from_locidispid, x.company AS from_isp, a.countrycode AS from_country, a.region AS from_region, @@ -34,6 +35,7 @@ module JamRuby s.buserid AS to_user_id, s.blatencytestid AS to_latency_tester_id, s.baddr AS to_addr, + s.blocidispid AS to_locidispid, y.company AS to_isp, b.countrycode AS to_country, b.region AS to_region, diff --git a/ruby/spec/jam_ruby/models/score_history_spec.rb b/ruby/spec/jam_ruby/models/score_history_spec.rb index 67fcdae11..8c16dfc0c 100644 --- a/ruby/spec/jam_ruby/models/score_history_spec.rb +++ b/ruby/spec/jam_ruby/models/score_history_spec.rb @@ -38,6 +38,7 @@ describe ScoreHistory do score_history.from_user_id.should == score1.auserid score_history.from_latency_tester_id.should == score1.alatencytestid score_history.from_addr.should == score1.aaddr + score_history.from_locidispid.should == score1.alocidispid score_history.from_isp.should == austin[:jamisp].jam_company.company score_history.from_country.should == austin[:geoiplocation].countrycode score_history.from_region.should == austin[:geoiplocation].region @@ -49,6 +50,7 @@ describe ScoreHistory do score_history.to_user_id.should == score1.buserid score_history.to_latency_tester_id.should == score1.blatencytestid score_history.to_addr.should == score1.baddr + score_history.to_locidispid.should == score1.blocidispid score_history.to_isp.should == dallas[:jamisp].jam_company.company score_history.to_country.should == dallas[:geoiplocation].countrycode score_history.to_region.should == dallas[:geoiplocation].region