-
Notifications
You must be signed in to change notification settings - Fork 0
/
project_worktype.py
38 lines (33 loc) · 1.15 KB
/
project_worktype.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
__author__ = 'Rod Jacka'
__copyright__ = 'Copyright 2017, Panalysis PTY LTD'
from distutils.util import strtobool
class ProjectWorktype(object):
project_worktypes = {}
def __init__(self, data={}):
self.id = 0
self.local_id = None
self.project_id = None
self.work_type_id = 0
self.name = ""
self.hourly_rate = 0
self.estimated_time = 0
self.active = True
self.total = 0
if 'id' in data:
self.id = int(data['id'])
if 'worktypeid' in data:
self.work_type_id = int(data['worktypeid'])
if 'projectid' in data:
self.project_id = int(data['projectid'])
if 'worktype' in data:
self.name = data['worktype']
if 'hourlyrate' in data:
self.hourly_rate = float(data['hourlyrate'])
if 'active' in data:
self.active = strtobool(data['active'])
if 'esttime' in data:
self.estimated_time = float(data['esttime'])
if 'total' in data:
self.total = float(data['total'])
if self.id > 0:
ProjectWorktype.project_worktypes[self.id] = self