Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get better at storing stuff in the DB.

  • Loading branch information...
commit 36ac47bf166829d531f129f73fa6242983d98570 1 parent 205f452
@davorg authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 PoliticalWeb/lib/PoliticalWeb.pm
View
10 PoliticalWeb/lib/PoliticalWeb.pm
@@ -180,6 +180,16 @@ sub get_mp_from_twfy {
# debug "TWFY: MP is " . Dumper $mp;
+ $mp->{db} = schema->resultset('Mp')->find_or_create({
+ mp_name => $mp->{full_name},
+ twfy_id => $mp->{person_id},
+ });
+
+ my ($con_db) = schema->resultset('Constituency')->find_or_create({
+ name => $_[0],
+ });
+ $con_db->update({ mp => $mp->{db}->id });
+
return $mp;
}
Please sign in to comment.
Something went wrong with that request. Please try again.