Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Get better at storing stuff in the DB.

  • Loading branch information...
commit 36ac47bf166829d531f129f73fa6242983d98570 1 parent 205f452
Dave Cross authored July 21, 2013

Showing 1 changed file with 10 additions and 0 deletions. Show diff stats Hide diff stats

  1. 10  PoliticalWeb/lib/PoliticalWeb.pm
10  PoliticalWeb/lib/PoliticalWeb.pm
@@ -180,6 +180,16 @@ sub get_mp_from_twfy {
180 180
 
181 181
   # debug "TWFY: MP is " . Dumper $mp;
182 182
 
  183
+  $mp->{db} = schema->resultset('Mp')->find_or_create({
  184
+    mp_name => $mp->{full_name},
  185
+    twfy_id => $mp->{person_id},
  186
+  });
  187
+
  188
+  my ($con_db) = schema->resultset('Constituency')->find_or_create({
  189
+    name => $_[0],
  190
+  });
  191
+  $con_db->update({ mp => $mp->{db}->id });
  192
+
183 193
   return $mp;
184 194
 }
185 195
 

0 notes on commit 36ac47b

Please sign in to comment.
Something went wrong with that request. Please try again.