Skip to content

Commit

Permalink
Merge pull request #314 from nottinghamtec/hotfix/ical
Browse files Browse the repository at this point in the history
Fix ical end dates being wrong by 24 hours
  • Loading branch information
davidtaylorhq authored Sep 25, 2017
2 parents 92acd17 + ca9e309 commit cf8edc8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions RIGS/ical.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def item_start_datetime(self, item):
return item.earliest_time

def item_end_datetime(self, item):
if isinstance(item.latest_time, datetime.date): # Ical end_datetime is non-inclusive, so add a day
if type(item.latest_time) == datetime.date: # Ical end_datetime is non-inclusive, so add a day
return item.latest_time + datetime.timedelta(days=1)

return item.latest_time
Expand Down Expand Up @@ -137,7 +137,7 @@ def item_description(self, item):
# if item.notes: // Need to add proper keyholder checks before this gets put back
# desc += 'Notes:\n'+item.notes+'\n\n'

base_url = "http://rigs.nottinghamtec.co.uk"
base_url = "https://rigs.nottinghamtec.co.uk"
desc += 'URL = ' + base_url + str(item.get_absolute_url())

return desc
Expand Down
10 changes: 9 additions & 1 deletion RIGS/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,9 @@ def setUp(self):
description="start past 1 week with end past")
models.Event.objects.create(name="TE E6", status=models.Event.BOOKED,
start_date=date.today() - timedelta(days=2),
end_date=date.today() + timedelta(days=2), description="start past, end future")
start_time=time(8, 00),
end_date=date.today() + timedelta(days=2),
end_time=time(23, 00), description="start past, end future")
models.Event.objects.create(name="TE E7", status=models.Event.BOOKED,
start_date=date.today() + timedelta(days=2),
end_date=date.today() + timedelta(days=2), description="start + end in future")
Expand Down Expand Up @@ -924,6 +926,8 @@ def testApiKeyGeneration(self):
# Awesome - all seems to work

def testICSFiles(self):
specialEvent = models.Event.objects.get(name="TE E6")

# Requests address
self.browser.get(self.live_server_url + '/user/')
# Gets redirected to login
Expand Down Expand Up @@ -953,6 +957,10 @@ def testICSFiles(self):
else:
self.assertNotContains(response, "TE E" + str(test) + " ")

# Check that times have been included correctly
self.assertContains(response, specialEvent.start_date.strftime('%Y%m%d') + 'T' + specialEvent.start_time.strftime('%H%M%S'))
self.assertContains(response, specialEvent.end_date.strftime('%Y%m%d') + 'T' + specialEvent.end_time.strftime('%H%M%S'))

# Only dry hires
self.browser.find_element_by_xpath("//input[@value='rig']").click()
self.browser.find_element_by_xpath("//input[@value='non-rig']").click()
Expand Down

0 comments on commit cf8edc8

Please sign in to comment.