Overkill

Yesterday I posted about four nearly identical functions that I thought could (and should) be reduced to just one somehow. Reducing it to one would be far less code to maintain if I find a faster way of doing it, or have to fix something. I found a good answer, but it’s not what I thought it would be.

The four functions:

1) Return open cases before a certain date

2) Return open cases after a certain date

3) Return closed cases before a certain date

4) Return closed cases after a certain date

I can replace all of those with thee functions:

1) Return open cases

2) Return closed cases

3) Return cases between certain dates

Or, I can roll the “is case open/closed” function into one somehow. Or, I guess I can roll all four into one function that needs to be passed a few parameters, like:

def CaseThatIsOpenedOrClosedBetweenDate(self, CaseOpenStatus, startdate, enddate)

I wanted to avoid doing stuff like that in the “library” so that the reports I create using functions in the library would be super easy to read.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s