forked from marc-shade/TeamForgeAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
current_project.py
67 lines (55 loc) · 2.58 KB
/
current_project.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# TeamForgeAI/current_project.py
class CurrentProject:
"""
Represents the current project, storing its re-engineered prompt, objectives, deliverables, and goal.
"""
def __init__(self):
"""Initializes the CurrentProject object with empty lists for objectives and deliverables."""
self.re_engineered_prompt = ""
self.objectives = []
self.deliverables = []
self.goal = ""
def set_re_engineered_prompt(self, prompt: str) -> str:
"""Sets the re-engineered prompt for the current project."""
self.re_engineered_prompt = prompt
return self.re_engineered_prompt
def add_objective(self, objective: str) -> list:
"""Adds an objective to the current project."""
self.objectives.append({"text": objective, "done": False})
return self.objectives
def add_deliverable(self, deliverable: str) -> list:
"""Adds a deliverable to the current project."""
self.deliverables.append({"text": deliverable, "done": False})
return self.deliverables
def set_goal(self, goal: str) -> str:
"""Sets the goal for the current project."""
self.goal = goal
return self.goal
def mark_objective_done(self, index: int) -> None:
"""Marks an objective at the specified index as done."""
if 0 <= index < len(self.objectives):
self.objectives[index]["done"] = True
def mark_deliverable_done(self, index: int) -> None:
"""Marks a deliverable at the specified index as done."""
if 0 <= index < len(self.deliverables):
self.deliverables[index]["done"] = True
def mark_objective_undone(self, index: int) -> None:
"""Marks an objective at the specified index as not done."""
if 0 <= index < len(self.objectives):
self.objectives[index]["done"] = False
def mark_deliverable_undone(self, index: int) -> None:
"""Marks a deliverable at the specified index as not done."""
if 0 <= index < len(self.deliverables):
self.deliverables[index]["done"] = False
def all_objectives_done(self) -> bool:
"""
Checks if all objectives are marked as done.
:return: True if all objectives are done, False otherwise.
"""
return all(objective["done"] for objective in self.objectives)
def all_deliverables_done(self) -> bool:
"""
Checks if all deliverables are marked as done.
:return: True if all deliverables are done, False otherwise.
"""
return all(deliverable["done"] for deliverable in self.deliverables)