Ejemplo n.º 1
0
def logOut(student):
    student.atLab = False

    #Tell the system that the student is no longer in the lab
    lastLoggedIn = student.lastLoggedIn

    #This sets the amount of a time a student gets if they fail to log out manually in minutes
    minutesWorked = 150

    #Create the "Time worked" object to be added to the student database
    timeWorked = HoursWorked(timeIn=lastLoggedIn,
                             autoLogout=True,
                             totalTime=minutesWorked)

    #Save the timeWorked object
    timeWorked.save()

    #Add the time worked object to the student so it can be viewed in the calender
    student.hoursWorked.add(timeWorked)

    #Add the minutes to the student's total time
    student.totalTime += minutesWorked

    #Save the student object
    student.save()

    #Return the number of minutes spent in the lab
    return minutesWorked
Ejemplo n.º 2
0
def logOut(student):
    #Tell the system that the student is no longer in the lab
    student.atLab=False

    #load the last logged in time into memory
    lastLoggedIn=student.lastLoggedIn

    #Get the time now so we get the most accurate  time in relation to when they logged in
    timeNow=timezone.now()

    #print (timeNow-lastLoggedIn).total_seconds

    #print type((timeNow-lastLoggedIn).total_seconds)

    #Get the time they were in the lab and convert it from seconds to minutes
    minutesWorked=float((timeNow-lastLoggedIn).total_seconds())
    minutesWorked=minutesWorked/60

    #Create the "Time worked" object to be added to the student database
    timeWorked=HoursWorked(timeIn=lastLoggedIn,timeOut=timeNow, totalTime=minutesWorked)
    timeWorked.save()

    #add the time worked object to the student so it can be viewed in the calander
    student.hoursWorked.add(timeWorked)

    #add the minutes to the student's total time
    student.totalTime+=minutesWorked

    #Save the student object
    student.save()


    #Return the number of minutes
    return minutesWorked
Ejemplo n.º 3
0
def logOut(student):
    student.atLab=False

    #Tell the system that the student is no longer in the lab
    lastLoggedIn=student.lastLoggedIn

    #This sets the amount of a time a student gets if they fail to log out manually in minutes
    minutesWorked=150

    #Create the "Time worked" object to be added to the student database
    timeWorked=HoursWorked(timeIn=lastLoggedIn,autoLogout=True, totalTime=minutesWorked)

    #Save the timeWorked object
    timeWorked.save()

    #Add the time worked object to the student so it can be viewed in the calender
    student.hoursWorked.add(timeWorked)

    #Add the minutes to the student's total time
    student.totalTime+=minutesWorked

    #Save the student object
    student.save()


    #Return the number of minutes spent in the lab
    return minutesWorked
Ejemplo n.º 4
0
def logOut(student):
    #Tell the system that the student is no longer in the lab
    student.atLab=False
    
    #load the last logged in time into memory
    timeIn=student.lastLoggedIn
    
    timeWorked=HoursWorked(timeIn=timeIn,timeOut=timeIn,owner=student,autoLogout=True)
    timeWorked.save()
    #add the time worked object to the student so it can be viewed in the calander
    student.hoursWorked.add(timeWorked)
    #add the minutes to the student's total time
    student.save()
Ejemplo n.º 5
0
def logOut(student, save, autolog, outsidelabhours):
    #Tell the system that the student is no longer in the lab
    student.atLab=False

    #load the last logged in time into memory
    timeIn=student.lastLoggedIn

    #Get the time now so we get the most accurate  time in relation to when they logged in
    timeOut=datetime.now()
    
    timeWorked=HoursWorked(timeIn=timeIn,timeOut=timeOut,owner=student)
    timeWorked.save()
    
    if timeWorked.totalTime < 60.0:
    	timeWorked.autoLogout = True
    	timeWorked.save()
    
    #add the time worked object to the student so it can be viewed in the calander
    student.hoursWorked.add(timeWorked)
    #add the minutes to the student's total time
    student.save()
    
    return timeWorked.totalTime/60 #TODO: update with minutes worked