[LON-CAPA-cvs] cvs: modules /msu localenroll.pm
raeburn
raeburn at source.lon-capa.org
Fri Mar 1 00:53:16 EST 2013
raeburn Fri Mar 1 05:53:16 2013 EDT
Modified files:
/modules/msu localenroll.pm
Log:
- Customization for msu domain.
- Default credits for each official course retreived from SISInfo
- Student's credits included in XML record for each student in classlists
retrieved from RO.
Index: modules/msu/localenroll.pm
diff -u modules/msu/localenroll.pm:1.62 modules/msu/localenroll.pm:1.63
--- modules/msu/localenroll.pm:1.62 Thu Sep 20 19:12:37 2012
+++ modules/msu/localenroll.pm Fri Mar 1 05:53:15 2013
@@ -1,6 +1,6 @@
# functions to glue school database system into Lon-CAPA for
# automated enrollment
-# $Id: localenroll.pm,v 1.62 2012/09/20 19:12:37 raeburn Exp $
+# $Id: localenroll.pm,v 1.63 2013/03/01 05:53:15 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,9 +137,9 @@
$sem =~tr/a-z/A-Z/;
$subj =~tr/a-z/A-Z/;
$crse =~tr/a-z/A-Z/;
- my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name FROM LONCAPA_ClassList WHERE Term_Code = '$sem' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec' ORDER BY Student_Name");
+ my $sth = $dbh->prepare("SELECT Pid,Pilot_Id,Student_Name,Sctn_Crdt_Hours FROM LONCAPA_ClassList WHERE Term_Code = '$sem' AND Subj_Code = '$subj' AND Crse_Code = '$crse' AND Sctn_Code = '$sec' ORDER BY Student_Name");
$sth->execute();
- while ( my($pid,$pilot,$name) = $sth->fetchrow_array ) {
+ while ( my($pid,$pilot,$name,$credits) = $sth->fetchrow_array ) {
if ($pilot =~ m/^\w{2,8}$/) {
$pilotcount ++;
$name =~ s/^\s+//;
@@ -168,6 +168,8 @@
<middlename>$middle</middlename>
<startdate></startdate>
<studentID>$pid</studentID>
+ <credits>$credits</credits>
+ <inststatus>Student</inststatus>
</student>
|;
} elsif ($pilot eq '') {
@@ -435,6 +437,7 @@
my ($dom,$instcode,$owner) = @_;
my $outcome = '';
my $description = '';
+ my $credits = 0;
my %longsem = (
fs => 'Fall',
ss => 'Spring',
@@ -532,6 +535,24 @@
if ($@) {
$outcome = "There was a problem connecting to the SIS database, so the course number could not be validated.";
}
+ if ($outcome eq 'valid') {
+ my $seqid = &semyr_to_seqid($term,$sem,$yr);
+ eval {
+ my $credsth = $dbh->prepare("SELECT Start_Term_Seq_Id,End_Term_Seq_Id,Credits FROM SISCRSD WHERE Subj_Code = '$subj' AND Crse_Code = '$crse'");
+ $credsth->execute();
+ while (my($start_seqid,$end_seqid,$creds) = $credsth->fetchrow_array) {
+ $start_seqid =~ s/^0//;
+ $end_seqid =~ s/^0//;
+ if (($seqid >= $start_seqid) &&
+ ($seqid <= $end_seqid)) {
+ if ($creds > $credits) {
+ $credits = $creds;
+ }
+ }
+ }
+ $credsth->finish;
+ };
+ }
}
}
if ($dbflag) {
@@ -542,7 +563,10 @@
} else {
$outcome = "One or more of the combination of semester, year, subject and course number you provided do not conform to the format used at MSU.";
}
- return ($outcome,$description);
+ if (!$credits) {
+ undef($credits);
+ }
+ return ($outcome,$description,$credits);
}
sub crsreq_checks {
More information about the LON-CAPA-cvs
mailing list