Skip to content

Commit

Permalink
update fasting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
corei8 committed Jul 10, 2023
1 parent 3c030a3 commit 5bf76bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
29 changes: 20 additions & 9 deletions ordotools/tools/feast.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, feast_date: datetime, properties: dict):
if 'vespers' in properties.keys() else {}
self.compline = properties['compline'] \
if 'compline' in properties.keys() else {}
self.fasting = properties['fasting']
self._fasting = properties["fasting"]

@ property
def feast_date_display(self) -> str:
Expand Down Expand Up @@ -68,18 +68,29 @@ def preces(self) -> str:
def feast(self) -> str:
return self.feast_properties['feast']

@ property
def updated_properties(self) -> dict:
""" Updates all values of the feast's dictionary """
@property
def fasting(self):
"""
Return fast (or abstinence) days as a boolean.
"""
return self._fasting

@fasting.setter
def fasting(self, value):
if self.com and "fasting" in self.com[0]:
if self.com[0]["fasting"]:
fasting = self.com[0]["fasting"]
self._fasting = self.com[0]["fasting"]
else:
fasting = self.fasting
self._fasting = self.feast_properties["fasting"]
elif int(self.date.strftime("%m")) == 5:
fasting = True
self._fasting = True
else:
fasting = self.fasting
self._fasting = self.feast_properties["fasting"]
return self._fasting

@ property
def updated_properties(self) -> dict:
""" Updates all values of the feast's dictionary """
dic = {
"feast": self.name,
"rank": [self.rank_n, self.rank_v],
Expand All @@ -94,7 +105,7 @@ def updated_properties(self) -> dict:
"nobility": self.nobility,
"office_type": self.office_type,
"com": self.com,
"fasting": fasting,
"fasting": self.fasting,
}
return dic

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = ordotools
version = 0.0.24
version = 0.0.25
description = A set of tools for producing a traditional Catholic Ordo, given a year and diocese
long_description = file: README.rst
long_desciption_content_type = text/rst
Expand Down

0 comments on commit 5bf76bc

Please sign in to comment.