Skip to content

Commit

Permalink
Remove debugging comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PhongT16 committed Nov 3, 2023
1 parent 364bac2 commit fa6d84f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 35 deletions.
7 changes: 0 additions & 7 deletions IndividualCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,6 @@ def process_individual_calendars(calendar, start_date, end_date):
simple_events = SimpleEvent.create_event_for_individual_calendars(event, start_date, end_date, net_id)
filtered_events.extend(simple_events)

if (net_id == "pttran3"):
print(event)
for a in simple_events:
print(a)
print("-----------------------------------------")


except KeyError as e:
logger.warning(f"Unable to find: " + net_id)

Expand Down
30 changes: 2 additions & 28 deletions SimpleEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,33 +53,19 @@ def create_event_for_individual_calendars(cls, event, start_date, end_date, net_
# if an event goes in here, then it's all day because the start date and end date differ by one day so it has to be at least be 1 All Day
# Automatically All Day
dates_interval = end - start

if (net_id == "pttran3"):
print(f"dates_interval: {dates_interval}")

add_on = 0
remaining_hours = dates_interval.seconds // 3600

if (remaining_hours!= 0):
print("first add")
add_on = add_on + 1

# if (start.time() >= )

midnight_start_time = time(0, 0, 0, 0)

if (net_id == "pttran3"):
print(f"midnight_start_time: {midnight_start_time}")
print(f"start time of event: {start.time()}")

midnight_start_time = time(0, 0, 0, 0)

if (start.time() != midnight_start_time and end.time() <= start.time()):
print("second add")
add_on = add_on + 1

if (net_id == "pttran3"):
print(f"Going over {dates_interval.days + add_on} days")

add_on = add_on + 1

for i in range(dates_interval.days + add_on): # The plus accounts for the last day of the multiday event. Even if it's just one All-Day

Expand All @@ -89,32 +75,20 @@ def create_event_for_individual_calendars(cls, event, start_date, end_date, net_
new_start = start + timedelta(days=i)
new_end = end + timedelta(days=i)
new_end = new_end.replace(year=new_start.year, month=new_start.month, day=new_start.day)
if (net_id == "pttran3"):
print(f"org new start: {new_start}")
print(f"org new end: {new_end}")


# Adjust the time so that we can create an accurate subject for the split up event
# Manipulating the time for the simple event here

if (i == 0):
#print("here 1")
new_end = new_end.replace(hour=23,minute=59,second=59)
elif (i == dates_interval.days + add_on - 1):
#print("here 2")
new_start = new_start.replace(hour=0,minute=0,second=0)
if (new_end.time() == midnight_start_time):
new_end = new_end.replace(hour=23,minute=59,second=59)
else:
#print("here 3")
new_start = new_start.replace(hour=0,minute=0,second=0)
new_end = new_end.replace(hour=23,minute=59,second=59)

if (net_id == "pttran3"):
print(f"new start: {new_start}")
print(f"new end: {new_end}")
print("++++++++++++++++++++++++++++++++++++++++++++")

if SimpleEvent.is_event_valid(start_date, end_date, new_start, new_end):
events.append(cls(net_id, SimpleEvent.get_event_subject(new_start, new_end, net_id), new_start))

Expand Down

0 comments on commit fa6d84f

Please sign in to comment.