my $commit_mode = 'rollback'; # single xact, then rollback (for testing)
my $is_teacher = 0;
my $is_classroom = 0;
+my $is_college = 0;
my $purge_all = 0;
my $force_new = 0;
my $out_dir = '.';
'default-pass=s' => \$default_pass,
'teacher' => \$is_teacher,
'classroom' => \$is_classroom,
+ 'college' => \$is_college,
'log-stdout' => \$log_stdout,
'out-dir=s' => \$out_dir,
'db-user=s' => \$db_user,
return;
}
+ if ($is_college) {
+ # college cards expire after 4 years.
+ $now_date->set_year($now_year + 4);
+ $phash->{expire_date} = $now_date;
+ return;
+ }
+
my ($year, $mon, $day) = ($phash->{dob} =~ /(\d{4})-(\d{2})-(\d{2})/);
my $expire_year = $now_year + ($expire_age - ($now_year - $year));
414 # Lake Washington
415 # Kent
417 # Northshore
+);
+
+# College students are processed differently
+COLLEGE_CODES=(
"lwt" # Lake Washington Institute of Technology
);
# Hard-code the districts eligible for automatic teacher account processing.
+# College teacher accounts are processed the same as school teacher accounts.
TEACHER_DISTRICTS=(
402 # Vashon
403 # Renton
for FILE in $($SSH "$COMMAND -l"); do
LOCAL_FILE=$(basename $FILE)
TEACHER_FLAG=""
+ COLLEGE_FLAG=""
announce "Inspecting file $FILE"
# File format examples:
# 415.2016-03-18.csv
# 415.teacher.2016-03-18.csv
- if [[ $LOCAL_FILE =~ ^[0-9]{3}.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then
+ if [[ $LOCAL_FILE =~ ^[0-9a-z]{3}.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then
announce "Found a student file."
+
+ if [[ " ${COLLEGE_CODES[@]} " =~ " $code " ]]; then
+ announce "Processing a college student file"
+ COLLEGE_FLAG="--college"
+ fi
else
- if [[ $LOCAL_FILE =~ ^[0-9]{3}.teacher.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then
+ if [[ $LOCAL_FILE =~ ^[0-9a-z]{3}.teacher.[0-9]{4}-[0-9]{2}-[0-9]{2}.csv$ ]]; then
announce "Found a teacher file."
if [[ " ${TEACHER_DISTRICTS[@]} " =~ " $code " ]]; then