Ejemplo n.º 1
0
        private Caregiver getAvailableCaregiver(List<Caregiver> unRosteredCaregivers, AttendanceRequest bringWish)
        {
            // TODO: LINQ

            //// TODO: check if not exceeding max number with adding the parent's children
            foreach (Caregiver caregiver in unRosteredCaregivers)
            {
                if (caregiver.AvailableAttendance.Contains(bringWish))
                    return caregiver;
            }
            return null;
        }
Ejemplo n.º 2
0
        private FIT_RESULT addToRoster(WeekRoster roster, Child currentChild, AttendanceRequest bringWish)
        {
            List<Child> children = roster.getChildren(bringWish.Dayparts);
            List<Caregiver> caregivers = roster.getCaregivers(bringWish.Dayparts);
            if (children.Count >= 13) // TODO: remove magic numbers
                return FIT_RESULT.FULL;
            if (children.Count + 1 - caregivers.Count * 5 > 0) // TODO: remove magic numbers
                return FIT_RESULT.INSUFFICIENT_CAREGIVERS;
            // TODO: max 3 babies

            roster.addChild(bringWish.Dayparts, currentChild);
            return FIT_RESULT.SUCCESS;
        }
Ejemplo n.º 3
0
 private bool addCaregiver(WeekRoster roster, List<Caregiver> caregivers, AttendanceRequest bringWish)
 {
     List<Caregiver> rosteredCaregivers = roster.getCaregivers();            
     // first see if we can add a new parent before shifting            
     Caregiver availableCaregiver = getAvailableCaregiver(caregivers.Except(rosteredCaregivers).ToList(), bringWish);
     if (availableCaregiver != null)
     {
         roster.addCaregiver(bringWish.Dayparts, availableCaregiver);
         return true;
     }
     else
     {
         return shiftCaregiver(roster, caregivers, rosteredCaregivers, bringWish);
     }
 }
Ejemplo n.º 4
0
        public void StorePeriodRecord()
        {
            //Arrange
            var period = new AttendanceRequest()
            {
                Start = 200001,
                End = 201526,
                Dayparts = DayPart.MONDAY_MORNING
            };
            
            //Act
            context.Periods.Add(period);
            context.SaveChanges();

            //Assert
            Assert.IsTrue(RunDatabaseAsserts());
        }
Ejemplo n.º 5
0
        public void StorePeriodRecordAndRetrieve()
        {
            //Arrange
            var period = new AttendanceRequest
            {
                Start = 200001,
                End = 201526,
                Dayparts = DayPart.MONDAY_MORNING
            };

            context.Periods.Add(period);
            context.SaveChanges();

            //Act
            var retrievedPeriod = (from p in context.Periods select p).First();

            //Assert
            Assert.AreEqual(200001, retrievedPeriod.Start.Value);
            Assert.AreEqual(201526, retrievedPeriod.End.Value);
        }
Ejemplo n.º 6
0
 private bool shiftCaregiver(WeekRoster roster, List<Caregiver> parents, List<Caregiver> rosteredParents, AttendanceRequest bringWish)
 {
     // TODO: see if a parent can move to this day, put another on that day and move, return true on success
     // TODO: check if not exceeding max number with adding the parent's children
     return false;
 }
Ejemplo n.º 7
0
 private bool shiftChild(WeekRoster roster, AttendanceRequest bringWish)
 {
     // TODO: see if a child can move away from this day, put it there, return true on success
     return false;
 }