Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
[Python][Django] Behemoth Class: KPI Calculator (God Object?)
Author Summary
illuzian is in Django
Post Body

http://pastebin.com/trhqUUDM

Preface: This isn't my primary role where I work but it does take a lot of my time where allowed.

This is some older code(written by myself) that I'm entirely unhappy with. Beside the lack of comments, I'm disappointed with it's complexity. it's pulling data from a lot of places and doing calculations that I think should be handle in separate classes. I think for example, that there should be a class for getting data from the databases and return a standard output regardless of whether we return 1 or more users(a dict or tuple)

I've honestly never had my Python code reviewed by anyone else as I'm completely self taught and where I work I have a lot of freedom an autonomy in terms of development.

I'd appreciate any feedback ranging from the class structure and anything I should be using from the Python and Django libraries.

Models CRMData = CRM log data, contains basic header information TeamMember = My add on class to django users TbldataAgentperformancebyperiod, TbldataAgentevents, TbldataAgentbydevice = Tables from an external commercial application where I have little control over the data, these tables all share similar data but in these cases have info I need that the others don't. Additionally, all data in these tables is broken into 15 minute intervals ranging from 0-96 to represent the time of the day.

There's quite a lot I'm not happy with across the entire project which spans many apps including this one but being one of the more substantial pieces of logic any feedback would be appreciated.

If you need any clarification on the code or any of the imports let me know. I'm pretty tired right now so hopefully this post makes sense.

Author
Account Strength
100%
Account Age
15 years
Verified Email
Yes
Verified Flair
No
Total Karma
4,153
Link Karma
950
Comment Karma
3,203
Profile updated: 5 days ago
Posts updated: 10 months ago

Subreddit

Post Details

Location
We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
9 years ago