BellevueCollege / CtcApi

A standardized, reusable, open source code library developed by and for the Community & Technical Colleges of Washington State in the creation of their own software applications.
Other
9 stars 3 forks source link

Account for clustered classes in seat availability #5

Open cmshawns opened 11 years ago

cmshawns commented 11 years ago

In ODS:

geol106-geog106 clustered

cmshawns commented 11 years ago

LINQ research:

from s in Vw_Class
//join l in Vw_ClassCluster on string.Concat(s.ClusterItemNumber, s.YearQuarterID) equals l.ClassClusterID
where s.ClassID == "3545B124"
select new {
    s.ClassID,
    IsClustered = s.ClusterItemNumber != null,
    SeatsAvailable = s.ClusterItemNumber != null ?
                        Vw_ClassCluster.Where(l => string.Concat(s.ClusterItemNumber, s.YearQuarterID) == l.ClassClusterID)
                        .Select (l => l.ClusterCapacity - l.ClusterEnrolled)
                        .First()
                    : s.ClassCapacity - s.StudentsEnrolled,
    s.ClassCapacity,
    s.StudentsEnrolled,
    // l.ClusterCapacity,
    // l.ClusterEnrolled,
}
cmshawns commented 11 years ago

This was done directly in the database for the Class Schedule app, but we still should include this logic in the API.