| 8 | | |
|---|
| 9 | | class TimeAdjustment(dt.timedelta): |
|---|
| 10 | | |
|---|
| 11 | | adj_date = dt.datetime.today() |
|---|
| 12 | | start = 0 |
|---|
| 13 | | end = 0 |
|---|
| 14 | | duration = 0 |
|---|
| 15 | | |
|---|
| 16 | | # If we aren't given a complete duration of time, we will need to wait |
|---|
| 17 | | # in the User class until we have one |
|---|
| 18 | | waiting = 0 |
|---|
| 19 | | |
|---|
| 20 | | def __init__(self, start=None, end=None, duration=None, date=None): |
|---|
| 21 | | # All of these should be datetime objects, except for duration which should be |
|---|
| 22 | | # a relativedelta object |
|---|
| 23 | | if (not start == None): |
|---|
| 24 | | self.start = start |
|---|
| 25 | | waiting = 1 |
|---|
| 26 | | if (not end == None): |
|---|
| 27 | | self.end = end |
|---|
| 28 | | waiting = 0 |
|---|
| 29 | | if (not duration == None): |
|---|
| 30 | | self.duration = duration |
|---|
| 31 | | waiting = 0 |
|---|
| 32 | | if (not date == None): |
|---|
| 33 | | adj_date = date |
|---|
| | 8 | from myplugs.libtracker.timeadjustment import TimeAdjustment |
|---|
| | 9 | from myplugs.libtracker.auth import check_auth |
|---|
| | 10 | from myplugs.libtracker.entry import add |
|---|
| 46 | | setdate_re = r"^(?:(?:on )?(?P<prefix>\b\w+\b|\b\d{2,2}\b.\b\d{1,2}\b.\b\d{2,4}\b|\b\w+\b.\b\d{1,2}(?:,.\d{2,4})?).?[,:])?" |
|---|
| | 29 | setdate_re = r"^(?:(?:on )?(?P<prefix>\b\w+\b|\b\d{2,2}\b.\b\d{1,2}\b.\b\d{2,4}\b|\b\w+\b.\b\d{1,2}(?:,.\d{2,4})?).?[,:] ?)?" |
|---|
| 70 | | #time = repr(relativedelta(parse(time, fuzzy = True), dt.date.today())) |
|---|
| 71 | | time = repr(relativedelta(parse(t_two, fuzzy = True), parse(t_one, fuzzy = True))) |
|---|
| 72 | | reply = "Worked on: " + date.ctime() + " for " + time |
|---|
| | 53 | start = parse(t_one, fuzzy = True) |
|---|
| | 54 | end = parse(t_two, fuzzy = True) |
|---|
| | 55 | time = relativedelta(end, start) |
|---|
| | 56 | reply = "Worked on: " + date.ctime() + " for " + repr(time) |
|---|