Works again. Code had to be altered to take into account LWVUS's new, and somewhat broken, column structure.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
Custom developed software for the League of Women Voters of West Virginia
|
||||
|
||||
## Format for roster
|
||||
The csv file should have all fields `quoted` to avoid issues where a field may have an additional comma. If file is not shipped this way, this can easily be corrected through the editor.
|
||||
## IMPORTANT: Format for roster
|
||||
The csv file should have all fields `quoted` to avoid issues where a field may have an additional comma. If file is not shipped this way, this can easily be corrected through the editor. However, the regexp fails if the first column is empty `/^,/`. Until we can find a better regexp to handle this sitution, the current solution is to replace all `/^,/` with `"",` which can be done with an editor like Visual Studio Code in addition to using something like calc.
|
||||
|
||||
## LLAW Google Civic Information API Query version 1
|
||||
Copyright (C) 2023 - by Jonathan Rosenbaum
|
||||
|
||||
Regular → Executable
+14
-11
@@ -69,20 +69,23 @@ while ( my $line = <$fh> ) {
|
||||
|
||||
# my @fields = split( /,/, $line );
|
||||
# may be commas between those quotes
|
||||
my @fields = $line =~ m/("[^"]+"|[^,]+)(?:,\s*)?/g;
|
||||
( my $leagueId = $fields[0] ) =~ s/"//g; # League
|
||||
my @fields = $line =~ m/(?:,|\n|^)("(?:(?:"")*[^"]*)*"|[^",\n]*|(?:\n|$))/g; #m/("[^"]+"|[^,]+)(?:,\s*)?/g;
|
||||
# print $#fields . "\n";
|
||||
( my $leagueId = $fields[1] ) =~ s/"//g; # League
|
||||
( my $firstName = $fields[4] ) =~ s/"//g; # First Name
|
||||
( my $lastName = $fields[5] ) =~ s/"//g; # Last Name
|
||||
( my $status = $fields[6] ) =~ s/"//g; # Active
|
||||
( my $joinDate = $fields[9] ) =~ s/"//g; # Join Date
|
||||
( my $phone = $fields[10] ) =~ s/"//g; # Phone
|
||||
( my $email = $fields[11] ) =~ s/"//g; # Email
|
||||
( my $street = $fields[12] ) =~ s/"//g; # Street
|
||||
( my $city = $fields[13] ) =~ s/"//g; # City
|
||||
( my $state = $fields[14] ) =~ s/"//g; # State
|
||||
( my $zip = $fields[16] ) =~ s/"//g; # Zip
|
||||
( my $status = $fields[7] ) =~ s/"//g; # Active
|
||||
( my $joinDate = $fields[10] ) =~ s/"//g; # Join Date
|
||||
( my $phone = $fields[11] ) =~ s/"//g; # Phone
|
||||
( my $email = $fields[12] ) =~ s/"//g; # Email
|
||||
( my $street = $fields[13] ) =~ s/"//g; # Street
|
||||
( my $city = $fields[14] ) =~ s/"//g; # City
|
||||
( my $state = $fields[15] ) =~ s/"//g; # State
|
||||
( my $zip = $fields[17] ) =~ s/"//g; # Zip
|
||||
next if $street eq "Mailing Street";
|
||||
next if $leagueId !~ /^WV/;
|
||||
if ( $leagueId !~ /^WV/ && $leagueId ne "LWV Of West Virginia") {
|
||||
next;
|
||||
}
|
||||
|
||||
if ( $searchType ne "google"
|
||||
&& $searchType ne "ALL" )
|
||||
|
||||
Reference in New Issue
Block a user