Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- class Task:
- def __init__(self, task_id, cen, project, task_name, tag, status, reg, gor_strash, inter, pol, obaz, legk, bist):
- self.task_id = task_id
- self.cen = cen
- self.project = project
- self.task_name = task_name
- self.tag = tag
- self.status = status
- self.reg = reg
- self.gor_strash = gor_strash
- self.inter = inter
- self.pol = pol
- self.obaz = obaz
- self.legk = legk
- self.bist = bist
- self.bist_legk = self.legk + self.bist
- self.prior = (self.legk + self.bist + self.pol + self.obaz*self.obaz) * self.gor_strash
- self.creation_date = datetime.datetime.now()
- self.comments = []
- def change_status(self, new_status):
- self.status = new_status
- def change_tag(self, new_tag):
- self.tag = new_tag
- def add_comment(self, comment):
- self.comments.append(comment)
- class Project:
- def __init__(self, project_id, reg, gor_strash, inter, pol, obaz, legk, bist, is_open):
- self.project_id = project_id
- self.reg = reg
- self.gor_strash = gor_strash
- self.inter = inter
- self.pol = pol
- self.obaz = obaz
- self.legk = legk
- self.bist = bist
- self.bist_legk = self.legk + self.bist
- self.prior = (self.legk + self.bist + self.pol + self.obaz*self.obaz) * self.gor_strash
- self.is_open = is_open
- self.tasks = []
- def add_task(self, task):
- self.tasks.append(task)
- def remove_task(self, task):
- self.tasks.remove(task)
- def change_status(self, new_status):
- self.is_open = new_status
- class Event:
- def __init__(self, id, task_id, action, attribute, timestamp, project):
- self.id = id
- self.task_id = task_id
- self.action = action
- self.attribute = attribute
- self.timestamp = timestamp
- self.project = project
- def execute(self):
- for task in self.project.tasks:
- if task.id == self.task_id:
- if self.action == "change" and self.attribute == "status":
- task.change_status("done") # changing the status
- elif self.action == "change" and self.attribute == "tag":
- task.change_tag("new_tag") # changing the tag
- elif self.action == "add" and self.attribute == "comment":
- task.add_comment("new comment") # adding a comment
Advertisement
Add Comment
Please, Sign In to add comment