Enhances CSV handling by adding status field extraction and filtering for primary status in google-civic-api.pl; updates .gitignore to include CSV files. Handles roster csv for MAL properly, but really not neccessary now that MAL's are in leage membership view file.
This commit is contained in:
parent
0d3f602fb8
commit
36e5a1735e
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,3 +35,4 @@ inc/
|
|||||||
/pm_to_blib
|
/pm_to_blib
|
||||||
/*.zip
|
/*.zip
|
||||||
env
|
env
|
||||||
|
*.csv
|
||||||
|
|||||||
@ -116,7 +116,7 @@ foreach my $file (@files) {
|
|||||||
$line =~ m/(?:,|\n|^)("(?:(?:"")*[^"]*)*"|[^",\n]*|(?:\n|$))/g
|
$line =~ m/(?:,|\n|^)("(?:(?:"")*[^"]*)*"|[^",\n]*|(?:\n|$))/g
|
||||||
; #m/("[^"]+"|[^,]+)(?:,\s*)?/g;
|
; #m/("[^"]+"|[^,]+)(?:,\s*)?/g;
|
||||||
# print $#fields . "\n";
|
# print $#fields . "\n";
|
||||||
my $leagueId, my $phone, my $email, my $joinDate;
|
my $leagueId, my $phone, my $email, my $joinDate, my $status;
|
||||||
if ($localLeague) {
|
if ($localLeague) {
|
||||||
|
|
||||||
# Local League file processing
|
# Local League file processing
|
||||||
@ -125,6 +125,7 @@ foreach my $file (@files) {
|
|||||||
( $phone = $fields[4] ) =~ s/"//g; # Phone
|
( $phone = $fields[4] ) =~ s/"//g; # Phone
|
||||||
( $email = $fields[3] ) =~ s/"//g; # Email
|
( $email = $fields[3] ) =~ s/"//g; # Email
|
||||||
( $joinDate = $fields[13] ) =~ s/"//g; # Join Date
|
( $joinDate = $fields[13] ) =~ s/"//g; # Join Date
|
||||||
|
( $status = $fields[12] ) =~ s/"//g; # Status - field [12] for Local League
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Members At Large (MAL) file processing
|
# Members At Large (MAL) file processing
|
||||||
@ -133,6 +134,7 @@ foreach my $file (@files) {
|
|||||||
( $phone = $fields[3] ) =~ s/"//g; # Phone
|
( $phone = $fields[3] ) =~ s/"//g; # Phone
|
||||||
( $email = $fields[4] ) =~ s/"//g; # Email
|
( $email = $fields[4] ) =~ s/"//g; # Email
|
||||||
( $joinDate = $fields[10] ) =~ s/"//g; # Join Date
|
( $joinDate = $fields[10] ) =~ s/"//g; # Join Date
|
||||||
|
( $status = $fields[13] ) =~ s/"//g; # Status - field [13] for MAL files
|
||||||
}
|
}
|
||||||
( my $firstName = $fields[0] ) =~ s/"//g; # First Name
|
( my $firstName = $fields[0] ) =~ s/"//g; # First Name
|
||||||
( my $lastName = $fields[2] ) =~ s/"//g; # Last Name
|
( my $lastName = $fields[2] ) =~ s/"//g; # Last Name
|
||||||
@ -140,9 +142,11 @@ foreach my $file (@files) {
|
|||||||
( my $city = $fields[6] ) =~ s/"//g; # City
|
( my $city = $fields[6] ) =~ s/"//g; # City
|
||||||
( my $state = $fields[7] ) =~ s/"//g; # State
|
( my $state = $fields[7] ) =~ s/"//g; # State
|
||||||
( my $zip = $fields[8] ) =~ s/"//g; # Zip
|
( my $zip = $fields[8] ) =~ s/"//g; # Zip
|
||||||
my $status = "true";
|
|
||||||
next if $street eq "Mailing Street";
|
next if $street eq "Mailing Street";
|
||||||
|
|
||||||
|
# Filter for Primary status only (Primary, Primary - Life, etc.)
|
||||||
|
next unless $status =~ /^Primary.*/;
|
||||||
|
|
||||||
if ( $leagueId !~ /^$STATE/ ) {
|
if ( $leagueId !~ /^$STATE/ ) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user