extends Button var timeslots = [] var current_timeslot = null var last_minute = -1 func populate(data): timeslots = data func _process(_delta): var time = Time.get_unix_time_from_system() var time_dict = Time.get_time_dict_from_unix_time(time) if time_dict.minute != last_minute: last_minute = time_dict.minute $"%Time".text = DataHelpers.timeofday(time) time = Time.get_unix_time_from_datetime_dict(time_dict) current_timeslot = null for timeslot in timeslots: if time >= timeslot.start_time && time <= timeslot.end_time: current_timeslot = timeslot break $"%Name".text = "Free Time" if current_timeslot == null else current_timeslot.name func _on_ScheduleHeader_button_up(): if current_timeslot != null: $"/root/Main".nav_screen("TimeSlot", TimeSlot, "get_by_id", [current_timeslot.id])