equal
deleted
inserted
replaced
1 from datetime import datetime |
1 from datetime import datetime |
2 from pytask.taskapp.models import Profile, Task, Comment, Credit |
2 from pytask.taskapp.models import Profile, Task, Comment, Credit, Claim |
3 |
3 |
4 def publishTask(task): |
4 def publishTask(task): |
5 """ set the task status to open """ |
5 """ set the task status to open """ |
6 |
6 |
7 task.status = "OP" |
7 task.status = "OP" |
37 |
37 |
38 main_task.subs.add(sub_task) |
38 main_task.subs.add(sub_task) |
39 main_task.status = "LO" |
39 main_task.status = "LO" |
40 main_task.save() |
40 main_task.save() |
41 return main_task |
41 return main_task |
|
42 |
|
43 def addClaim(task, message, user): |
|
44 """ add claim data to the database if it does not exist |
|
45 and also update the claimed users field of the task. |
|
46 """ |
|
47 |
|
48 task.claimed_users.add(user) |
|
49 task.status = "CL" |
|
50 task.save() |
|
51 claim = Claim() |
|
52 claim.message = message |
|
53 claim.task = task |
|
54 claim.user = user |
|
55 claim.creation_datetime = datetime.now() |
|
56 claim.save() |
|
57 |
|
58 def assignTask(task, user): |
|
59 """ check for the status of task and assign it to the particular user """ |
|
60 |
|
61 task.assigned_users.add(user) |
|
62 task.status = "AS" |
|
63 task.save() |