eleeet

ppzz5

Jun 28th, 2023 (edited)
1,041
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.50 KB | Source Code | 0 0
  1. import datetime
  2.  
  3. class Task:
  4.     def __init__(self, task_id, cen, project, task_name, tag, status, reg, gor_strash, inter, pol, obaz, legk, bist):
  5.         self.task_id = task_id
  6.         self.cen = cen
  7.         self.project = project
  8.         self.task_name = task_name
  9.         self.tag = tag
  10.         self.status = status
  11.         self.reg = reg
  12.         self.gor_strash = gor_strash
  13.         self.inter = inter
  14.         self.pol = pol
  15.         self.obaz = obaz
  16.         self.legk = legk
  17.         self.bist = bist
  18.         self.bist_legk = self.legk + self.bist
  19.         self.prior = (self.legk + self.bist + self.pol + self.obaz*self.obaz) * self.gor_strash
  20.         self.creation_date = datetime.datetime.now()
  21.         self.comments = []
  22.  
  23.     def change_status(self, new_status):
  24.         self.status = new_status
  25.  
  26.     def change_tag(self, new_tag):
  27.         self.tag = new_tag
  28.  
  29.     def add_comment(self, comment):
  30.         self.comments.append(comment)
  31.  
  32. class Project:
  33.     def __init__(self, project_id, reg, gor_strash, inter, pol, obaz, legk, bist, is_open):
  34.         self.project_id = project_id
  35.         self.reg = reg
  36.         self.gor_strash = gor_strash
  37.         self.inter = inter
  38.         self.pol = pol
  39.         self.obaz = obaz
  40.         self.legk = legk
  41.         self.bist = bist
  42.         self.bist_legk = self.legk + self.bist
  43.         self.prior = (self.legk + self.bist + self.pol + self.obaz*self.obaz) * self.gor_strash
  44.         self.is_open = is_open
  45.         self.tasks = []
  46.  
  47.     def add_task(self, task):
  48.         self.tasks.append(task)
  49.  
  50.     def remove_task(self, task):
  51.         self.tasks.remove(task)
  52.  
  53.     def change_status(self, new_status):
  54.         self.is_open = new_status
  55.  
  56. class Event:
  57.     def __init__(self, id, task_id, action, attribute, timestamp, project):
  58.         self.id = id
  59.         self.task_id = task_id
  60.         self.action = action
  61.         self.attribute = attribute
  62.         self.timestamp = timestamp
  63.         self.project = project
  64.  
  65.     def execute(self):
  66.         for task in self.project.tasks:
  67.             if task.id == self.task_id:
  68.                 if self.action == "change" and self.attribute == "status":
  69.                     task.change_status("done")  # changing the status
  70.                 elif self.action == "change" and self.attribute == "tag":
  71.                     task.change_tag("new_tag")  # changing the tag
  72.                 elif self.action == "add" and self.attribute == "comment":
  73.                     task.add_comment("new comment")  # adding a comment
  74.  
Advertisement
Add Comment
Please, Sign In to add comment