def main(): automaten = defect() #verkrijg alle automaten die als defect geregistreed zijn for i in automaten: #loop door alle defecte automaten monteur = chooseMechanic(i[3],i[4]) #verkrijg de meest dichtstbijzijnde monteur if (monteur[0] != 0): #test of de monteur bestaat sendMessage(monteur,i) #stuur een bericht naar die monteur else: print("Geen enkele monteur is momenteel beschikbaar")
def checkNotifications(): #time123 = time.strftime("%H:%M"); fromTime = datetime.datetime.now() toTime = fromTime - datetime.timedelta(minutes=2) print(str(toTime)) fromTime1 = str(fromTime.hour) + ":" + str(fromTime.minute) + ":" + "00" toTime1 = str(toTime.hour) + ":" + str(toTime.minute) + ":" + "00" print("******************************") print(fromTime1) print(toTime1) notifications = SelectUsersNotifications.selectAllNotificationsWhereEnableAndTime(toTime1, fromTime1) for notification in notifications: print(notification[5]) if str(notification[5]).strip() == 'False' and notification[4] == time.strftime("%Y-%m-%d"): sendMessage.sendMessage(str(notification[1]),str(notification[2])) if str(notification[5]).strip() == str('True'): print("inside if ") sendMessage.sendMessage(str(notification[1]),str(notification[2]))