Skip to content

Commit

Permalink
Merge pull request #384 from jdufresne/typo
Browse files Browse the repository at this point in the history
Fix all spellings of occurence -> occurrence
  • Loading branch information
kimarakov committed Jan 9, 2018
2 parents 4763463 + 08b8bd8 commit 104af8c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ This setting controls the behavior of `Views.get_next_url`. If set, all calendar

### SHOW_CANCELLED_OCCURRENCES

This setting controls the behavior of `Period.classify_occurence`. If True, then occurences that have been cancelled will be displayed with a css class of canceled, otherwise they won't appear at all.
This setting controls the behavior of `Period.classify_occurrence`. If True, then occurrences that have been cancelled will be displayed with a css class of canceled, otherwise they won't appear at all.

Defaults to False

Expand Down
2 changes: 1 addition & 1 deletion docs/settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This setting controls the behavior of :func:`Views.get_next_url`. If set, all ca
SHOW_CANCELLED_OCCURRENCES
--------------------------

This setting controls the behavior of :func:`Period.classify_occurence`. If True, then occurrences that have been cancelled will be displayed with a css class of canceled, otherwise they won't appear at all.
This setting controls the behavior of :func:`Period.classify_occurrence`. If True, then occurrences that have been cancelled will be displayed with a css class of canceled, otherwise they won't appear at all.

Defaults to False

Expand Down
2 changes: 1 addition & 1 deletion schedule/templates/fullcalendar_script.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
eventLimit: true, // allow 'more' link when too many events
selectable: true, //Allows a user to highlight multiple days or timeslots by clicking and dragging.
selectHelper: true,
events: "{% url 'api_occurences' %}?calendar_slug={{calendar_slug}}",
events: "{% url 'api_occurrences' %}?calendar_slug={{calendar_slug}}",
loading: function(bool) {
if (bool) {
$('#loading').show();
Expand Down
4 changes: 2 additions & 2 deletions schedule/templates/schedule/_day_cell_big.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
{% if day.has_occurrences %}
{% for o in day.get_occurrence_partials %}
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#occurenceModal">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#occurrenceModal">

<div class="starttime">
{% ifequal o.class 0 %}{{ o.occurrence.start|time:"G:i" }}{% endifequal %}
Expand All @@ -14,7 +14,7 @@
{% title o.occurrence %}
</div>
</div>
<div class="modal fade" id="occurenceModal" tabindex="-1" role="dialog" aria-labelledby="occurence_detailsl">
<div class="modal fade" id="occurrenceModal" tabindex="-1" role="dialog" aria-labelledby="occurrence_detailsl">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
Expand Down
2 changes: 1 addition & 1 deletion schedule/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
url(r'^ical/calendar/(.*)/$', CalendarICalendar(), name='calendar_ical'),

# api urls
url(r'^api/occurrences', api_occurrences, name='api_occurences'),
url(r'^api/occurrences', api_occurrences, name='api_occurrences'),
url(r'^api/move_or_resize/$',
api_move_or_resize_by_code,
name='api_move_or_resize'),
Expand Down
8 changes: 4 additions & 4 deletions schedule/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def occurrences_after(self, after=None):
generator = occurrences[0][1]

try:
next_occurence = heapq.heapreplace(occurrences, (next(generator), generator))[0]
next_occurrence = heapq.heapreplace(occurrences, (next(generator), generator))[0]
except StopIteration:
next_occurence = heapq.heappop(occurrences)[0]
yield occ_replacer.get_occurrence(next_occurence)
next_occurrence = heapq.heappop(occurrences)[0]
yield occ_replacer.get_occurrence(next_occurrence)


class OccurrenceReplacer(object):
Expand Down Expand Up @@ -83,7 +83,7 @@ def has_occurrence(self, occ):
if not self.lookup:
return False
else:
raise TypeError('A problem with checking if a persisted occurence exists has occured!')
raise TypeError('A problem with checking if a persisted occurrence exists has occured!')

def get_additional_occurrences(self, start, end):
"""
Expand Down
12 changes: 6 additions & 6 deletions tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def test_event_get_ocurrence(self):
occurrence = event.get_occurrence(start)
self.assertEqual(occurrence.start, start)

def test_occurences_after_with_no_params(self):
def test_occurrences_after_with_no_params(self):
cal = Calendar.objects.create(name='MyCal')
start = timezone.now() + datetime.timedelta(days=1)
event = self.__create_event(
Expand All @@ -274,7 +274,7 @@ def test_occurences_after_with_no_params(self):
self.assertEqual(occurrences[0].start, start)
self.assertEqual(occurrences[0].end, start + datetime.timedelta(hours=1))

def test_occurences_with_recurrent_event_end_recurring_period_edge_case(self):
def test_occurrences_with_recurrent_event_end_recurring_period_edge_case(self):
cal = Calendar.objects.create(name='MyCal')
rule = Rule.objects.create(frequency="DAILY")
start = timezone.now() + datetime.timedelta(days=1)
Expand All @@ -288,7 +288,7 @@ def test_occurences_with_recurrent_event_end_recurring_period_edge_case(self):
occurrences = list(event.occurrences_after())
self.assertEqual(len(occurrences), 11)

def test_occurences_with_recurrent_event_end_recurring_period_edge_case_max_loop_lower(self):
def test_occurrences_with_recurrent_event_end_recurring_period_edge_case_max_loop_lower(self):
cal = Calendar.objects.create(name='MyCal')
rule = Rule.objects.create(frequency="DAILY")
start = timezone.now() + datetime.timedelta(days=1)
Expand All @@ -302,7 +302,7 @@ def test_occurences_with_recurrent_event_end_recurring_period_edge_case_max_loop
occurrences = list(event.occurrences_after(max_occurrences=4))
self.assertEqual(len(occurrences), 4)

def test_occurences_with_recurrent_event_end_recurring_period_edge_case_max_loop_greater(self):
def test_occurrences_with_recurrent_event_end_recurring_period_edge_case_max_loop_greater(self):
cal = Calendar.objects.create(name='MyCal')
rule = Rule.objects.create(frequency="DAILY")
start = timezone.now() + datetime.timedelta(days=1)
Expand All @@ -316,7 +316,7 @@ def test_occurences_with_recurrent_event_end_recurring_period_edge_case_max_loop
occurrences = list(event.occurrences_after(max_occurrences=20))
self.assertEqual(len(occurrences), 11)

def test_occurences_with_recurrent_event_no_end_recurring_period_max_loop(self):
def test_occurrences_with_recurrent_event_no_end_recurring_period_max_loop(self):
cal = Calendar.objects.create(name='MyCal')
rule = Rule.objects.create(frequency="DAILY")
start = timezone.now() + datetime.timedelta(days=1)
Expand Down Expand Up @@ -436,7 +436,7 @@ def test_recurring_event_get_occurrence_across_dst(self):
def test_get_occurrences_timespan_inside_occurrence(self):
'''
Test whether occurrences are correctly obtained if selected timespan start
and end happen completely inside an occurence.
and end happen completely inside an occurrence.
'''
cal = Calendar.objects.create(name="MyCal")
rule = Rule.objects.create(frequency="WEEKLY")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_periods.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def test_day_range(self):
self.assertEqual(start, self.day.start)
self.assertEqual(end, self.day.end)

def test_occurence(self):
def test_occurrence(self):
self.assertEqual(self.event in [o.event for o in self.day.occurrences], True)


Expand Down
26 changes: 13 additions & 13 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_delete_event_authenticated_user(self):
response = self.client.get(reverse("delete_event", kwargs={"event_id": 1}))
self.assertEqual(response.status_code, 404)

def test_occurences_api_returns_the_expected_occurences(self):
def test_occurrences_api_returns_the_expected_occurrences(self):
# create a calendar and event
calendar = Calendar.objects.create(name="MyCal", slug='MyCalSlug')
rule = Rule.objects.create(frequency="DAILY")
Expand All @@ -199,24 +199,24 @@ def test_occurences_api_returns_the_expected_occurences(self):
)
# test calendar slug
response = self.client.get(
reverse("api_occurences") + "?calendar={}&start={}&end={}".format(
reverse("api_occurrences") + "?calendar={}&start={}&end={}".format(
'MyCal', datetime.datetime(2008, 1, 5), datetime.datetime(2008, 1, 6)))
self.assertEqual(response.status_code, 200)
expected_content = [{'existed': False, 'end': '2008-01-05T09:00:00Z', 'description': '', 'creator': 'None', 'color': '', 'title': 'Recent Event', 'rule': '', 'event_id': 8, 'end_recurring_period': '2008-05-05T00:00:00Z', 'cancelled': False, 'calendar': 'MyCalSlug', 'start': '2008-01-05T08:00:00Z', 'id': 9}]
self.assertEqual(json.loads(response.content.decode()), expected_content)

def test_occurences_api_without_parameters_return_status_400(self):
response = self.client.get(reverse("api_occurences"))
def test_occurrences_api_without_parameters_return_status_400(self):
response = self.client.get(reverse("api_occurrences"))
self.assertEqual(response.status_code, 400)

def test_occurrences_api_without_calendar_slug_return_status_404(self):
response = self.client.get(reverse("api_occurences"),
response = self.client.get(reverse("api_occurrences"),
{'start': datetime.datetime(2008, 1, 5),
'end': datetime.datetime(2008, 1, 6),
'calendar_slug': 'NoMatch'})
self.assertEqual(response.status_code, 400)

def test_occurences_api_checks_valid_occurrence_ids(self):
def test_occurrences_api_checks_valid_occurrence_ids(self):
# create a calendar and event
calendar = Calendar.objects.create(name="MyCal", slug='MyCalSlug')
rule = Rule.objects.create(frequency="DAILY")
Expand All @@ -239,7 +239,7 @@ def test_occurences_api_checks_valid_occurrence_ids(self):
)
# test calendar slug
response = self.client.get(
reverse("api_occurences") + "?calendar={}&start={}&end={}".format(
reverse("api_occurrences") + "?calendar={}&start={}&end={}".format(
'MyCal',
datetime.datetime(2008, 1, 5),
datetime.datetime(2008, 1, 8)))
Expand All @@ -248,7 +248,7 @@ def test_occurences_api_checks_valid_occurrence_ids(self):
self.assertEqual(json.loads(response.content.decode()), expected_content)
# test timezone param
response = self.client.get(
reverse("api_occurences") + "?calendar={}&start={}&end={}&timezone={}".format(
reverse("api_occurrences") + "?calendar={}&start={}&end={}&timezone={}".format(
'MyCal',
datetime.datetime(2008, 1, 5),
datetime.datetime(2008, 1, 8),
Expand All @@ -257,7 +257,7 @@ def test_occurences_api_checks_valid_occurrence_ids(self):
expected_content = [{u'existed': False, u'end': u'2008-01-05T03:00:00-06:00', u'description': '', u'creator': u'None', u'color': '', u'title': u'Recent Event', u'rule': u'', u'event_id': 8, u'end_recurring_period': u'2008-01-07T18:00:00-06:00', u'cancelled': False, u'calendar': u'MyCalSlug', u'start': u'2008-01-05T02:00:00-06:00', u'id': 10}, {u'existed': False, u'end': u'2008-01-06T03:00:00-06:00', u'description': '', u'creator': u'None', u'color': '', u'title': u'Recent Event', u'rule': u'', u'event_id': 8, u'end_recurring_period': u'2008-01-07T18:00:00-06:00', u'cancelled': False, u'calendar': u'MyCalSlug', u'start': u'2008-01-06T02:00:00-06:00', u'id': 10}, {u'existed': False, u'end': u'2008-01-07T03:00:00-06:00', u'description': '', u'creator': u'None', u'color': '', u'title': u'Recent Event', u'rule': u'', u'event_id': 8, u'end_recurring_period': u'2008-01-07T18:00:00-06:00', u'cancelled': False, u'calendar': u'MyCalSlug', u'start': u'2008-01-07T02:00:00-06:00', u'id': 10}, {u'existed': True, u'end': u'2008-01-07T02:00:00-06:00', u'description': u'Persisted occ test', u'creator': u'None', u'color': '', u'title': u'My persisted Occ', u'rule': u'', u'event_id': 8, u'end_recurring_period': u'2008-01-07T18:00:00-06:00', u'cancelled': False, u'calendar': u'MyCalSlug', u'start': u'2008-01-07T02:00:00-06:00', u'id': 1}]
self.assertEqual(json.loads(response.content.decode()), expected_content)

def test_occurences_api_works_with_and_without_cal_slug(self):
def test_occurrences_api_works_with_and_without_cal_slug(self):
# create a calendar and event
calendar = Calendar.objects.create(name="MyCal", slug='MyCalSlug')
event = Event.objects.create(
Expand All @@ -269,13 +269,13 @@ def test_occurences_api_works_with_and_without_cal_slug(self):
)
# test calendar slug
response = self.client.get(
reverse('api_occurences'),
reverse('api_occurrences'),
{'start': '2008-01-05', 'end': '2008-02-05', 'calendar_slug': event.calendar.slug})
self.assertEqual(response.status_code, 200)
resp_list = json.loads(response.content.decode('utf-8'))
self.assertIn(event.title, [d['title'] for d in resp_list])
# test works with no calendar slug
response = self.client.get(reverse("api_occurences"),
response = self.client.get(reverse("api_occurrences"),
{'start': '2008-01-05',
'end': '2008-02-05'
})
Expand All @@ -301,7 +301,7 @@ def test_cal_slug_filters_returned_events(self):
calendar=calendar2,
)
# Test both present with no cal arg
response = self.client.get(reverse("api_occurences"),
response = self.client.get(reverse("api_occurrences"),
{'start': '2008-01-05',
'end': '2008-02-05'}
)
Expand All @@ -311,7 +311,7 @@ def test_cal_slug_filters_returned_events(self):
self.assertIn(event2.title, [d['title'] for d in resp_list])
# test event2 not in event1 response
response = self.client.get(
reverse("api_occurences"),
reverse("api_occurrences"),
{'start': '2008-01-05', 'end': '2008-02-05', 'calendar_slug': event1.calendar.slug})
self.assertEqual(response.status_code, 200)
resp_list = json.loads(response.content.decode('utf-8'))
Expand Down

0 comments on commit 104af8c

Please sign in to comment.