Skip to content

Commit

Permalink
Merge pull request #70 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: slate v2.1.9
  • Loading branch information
themightychris authored Sep 30, 2016
2 parents 275197c + 7bfdd27 commit df66537
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 10 deletions.
51 changes: 44 additions & 7 deletions php-classes/Slate/Connectors/AbstractSpreadsheetConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Slate\Connectors;

use DB;
use Slate;
use SpreadsheetReader;
use Emergence\Connectors\Job;
Expand Down Expand Up @@ -656,11 +657,11 @@ public static function pullEnrollments(Job $Job, $pretend = true, SpreadsheetRea


// initialize results
$rostersBySection = [];
$studentsBySection = [];
$sectionsByIdentifier = [];
$results = [
'analyzed' => 0,
'analyzed-enrollments' => 0
'rows-analyzed' => 0,
'enrollments-analyzed' => 0
];


Expand All @@ -674,7 +675,7 @@ public static function pullEnrollments(Job $Job, $pretend = true, SpreadsheetRea


// start logging analysis
$results['analyzed']++;
$results['rows-analyzed']++;
static::_logRow($Job, 'enrollments', $results['analyzed'], $row);


Expand Down Expand Up @@ -713,7 +714,7 @@ public static function pullEnrollments(Job $Job, $pretend = true, SpreadsheetRea
}

$Participant = null;
$results['analyzed-enrollments']++;
$results['enrollments-analyzed']++;

// Optionally split code based user value
if (!$Job->Config['enrollmentDivider']) {
Expand Down Expand Up @@ -743,7 +744,7 @@ public static function pullEnrollments(Job $Job, $pretend = true, SpreadsheetRea
continue;
}
} else {
$results['failed']['section-not-found'][$sectionIdentifier]++;
$results['enrollments-failed']['section-not-found'][$sectionIdentifier]++;
continue;
}
}
Expand All @@ -758,11 +759,47 @@ public static function pullEnrollments(Job $Job, $pretend = true, SpreadsheetRea
} elseif ($logEntry['action'] == 'update') {
$results['enrollments-updated']++;
}

// record enrollment in cache for pruning phase
$studentsBySection[$Section->ID][] = $Student->ID;
}
}
}


// scan current roster for students to remove
foreach ($studentsBySection AS $sectionId => $studentIds) {
$enrolledStudentIds = DB::allValues(
'PersonID',
'SELECT PersonID FROM `%s` WHERE CourseSectionID = %u AND Role = "Student"',
[
SectionParticipant::$tableName,
$sectionId
]
);

$removeStudentIds = array_diff($enrolledStudentIds, $studentIds);

if (count($removeStudentIds)) {
if (!$pretend) {
DB::nonQuery(
'DELETE FROM `%s` WHERE CourseSectionID = %u AND Role = "Student" AND PersonID IN (%s)',
[
SectionParticipant::$tableName,
$sectionId,
implode(',', $removeStudentIds)
]
);
}

$results['enrollments-removed'] += count($removeStudentIds);

foreach ($removeStudentIds AS $studentId) {
$Job->log(sprintf('Removed user %s from section %s with role Student', User::getByID($studentId)->getTitle(), Section::getByID($sectionId)->getTitle()));
}
}
}

// TODO: remove stale enrollments

return $results;
}
Expand Down
6 changes: 3 additions & 3 deletions site-root/sass/fonts/lato.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import 'compass/css3/font-face';

// @include font-face('Lato', inline-font-files('Lato/Lato-Light.woff', woff), false, 300, regular);
// @include font-face('Lato', inline-font-files('Lato/Lato-LightItalic.woff', woff), false, 300, italic);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatinLight-Regular.woff', woff), false, 300, regular);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatinLight-Italic.woff', woff), false, 300, italic);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatin-Regular.woff', woff), false, 400, regular);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatin-Italic.woff', woff), false, 400, italic);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatin-Bold.woff', woff), false, 700, regular);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatin-BoldItalic.woff', woff), false, 700, italic);
@include font-face('Lato', inline-font-files('LatoLatin/LatoLatin-BoldItalic.woff', woff), false, 700, italic);

0 comments on commit df66537

Please sign in to comment.