Beispiel #1
0
def createWaves(sked, rows, waves):
    for row in rows:
        i = int(row["wave_ID"])
        wave_entry = waves[i]
        #if verbose: print row["schedule_ID"],row["wave_ID"],row["priority"]
        w = Wave(i)
        #Plane times
        midnight = datetime.combine(sked.day, time(0))
        start_time = midnight + wave_entry["plane_start"]
        end_time = midnight + wave_entry["plane_end"]
        w.begin = start_time
        w.end = end_time
        w.times["Plane"].begin = start_time
        w.times["Plane"].end = end_time
        #Flyer times
        start_time = midnight + wave_entry["flyer_start"]
        end_time = midnight + wave_entry["flyer_end"]
        w.times["Flyer"].begin = start_time
        w.times["Flyer"].end = end_time
        w.schedule = sked
        w.priority = float(row["priority"])
        if wave_entry["student_multiple"] != None:
            w.studentMultiple = float(wave_entry["student_multiple"])
        sked.waves[i] = w
    sked.findExclusiveWaves()
Beispiel #2
0
    def createWaves(self):
        self.waves = {}
        _begin = datetime.combine(self.day, self.firstBrief) + self.briefLength
        for i in range(1, self.waveNumber + 1):
            _end = _begin + self.waveLength
            w = Wave(i)
            w.begin = _begin
            w.end = _end
            w.schedule = self
            w.times["Flyer"].begin = _begin - self.briefLength
            w.times["Flyer"].end = _end + self.briefLength
            w.times["Plane"].begin = _begin
            w.times["Plane"].end = _end
            self.waves[i] = w
            _begin = _end

        self.findExclusiveWaves()
Beispiel #3
0
 def create_waves(self, sked):
     for i in range(1, 6):
         w = Wave(i)
         #Plane times
         dawn = datetime.combine(sked.date, sked.dawn)
         start_time = dawn + timedelta(hours=(i-1)*2.5)
         end_time = dawn + timedelta(hours=i*2.5)
         w.begin = start_time
         w.end = end_time
         w.times["Plane"].begin = start_time
         w.times["Plane"].end = end_time
         #Flyer times
         start_time = start_time - timedelta(hours=1)
         end_time = start_time - timedelta(hours=1)
         w.times["Flyer"].begin = start_time
         w.times["Flyer"].end = end_time
         w.schedule = sked
         w.priority = 1.0
         sked.waves[i]=w
     sked.findExclusiveWaves()
Beispiel #4
0
def main():
    s = Sniv()
    s.begin = datetime(2015, 3, 28, 8)
    s.end = datetime(2015, 3, 28, 9, 30)
    w = Wave()
    w.begin = datetime(2015, 3, 28, 10)
    w.end = datetime(2015, 3, 28, 12, 30)
    w.times["Flyer"].begin = datetime(2015, 3, 28, 9)
    w.times["Flyer"].end = datetime(2015, 3, 28, 13, 30)
    w.times["Plane"].begin = datetime(2015, 3, 28, 10)
    w.times["Plane"].end = datetime(2015, 3, 28, 12, 30)
    r = Flyer(1)
    r.snivs[0] = s
    print "Flyer"
    print r.available(date(2015, 3, 28), w)
    print r._available[date(2015, 3, 28)][w]

    print "Plane"
    p = Plane(1)
    p.snivs[0] = s
    print p.available(date(2015, 3, 28), w)
    print p._available[date(2015, 3, 28)][w]