Skip to content

Commit 5452414

Browse files
committed
fix codecov
1 parent 9ef6c2b commit 5452414

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

commands/createtask.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class CreateTask:
1515
greetings = ["Awesome", "Great", "Congratulations", "Well done", "Let's go"]
1616

1717
def __init__(self):
18-
self.payload = {"response_type": "ephemeral", "blocks": []}
18+
self.payload = {
19+
"response_type": "ephemeral",
20+
"blocks": []
21+
}
1922

2023
def create_task_input_blocks(self):
2124
block_description = {
@@ -73,7 +76,10 @@ def create_task_input_blocks(self):
7376
}
7477
block_actions_button = {
7578
"type": "button",
76-
"text": {"type": "plain_text", "text": "Create task"},
79+
"text": {
80+
"type": "plain_text",
81+
"text": "Create task"
82+
},
7783
"action_id": "create_action_button",
7884
}
7985
block_actions = {"type": "actions", "elements": []}
@@ -107,8 +113,6 @@ def create_task(self, desc, points, deadline):
107113
db.session.commit()
108114

109115
response = deepcopy(self.base_create_task_block_format)
110-
response["text"]["text"] = response["text"]["text"].format(
111-
greeting=random.choice(self.greetings), id=id
112-
)
116+
response["text"]["text"] = response["text"]["text"].format(greeting=random.choice(self.greetings), id=id)
113117
self.payload["blocks"].append(response)
114118
return self.payload["blocks"]

commands/taskdone.py

+11-14
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,33 @@
55
class TaskDone:
66
def __init__(self, data):
77
self.data = data
8-
self.payload = {"response_type": "ephemeral", "blocks": []}
8+
self.payload = {
9+
"response_type": "ephemeral",
10+
"blocks": []
11+
}
912

1013
# if get user id of given slack id/ create if not exists and return user id
1114
def get_or_create(self, uid):
1215
instance = db.session.query(User).filter_by(slack_user_id=uid).first()
1316
if instance:
1417
return instance
1518
else:
16-
instance = db.session.add(User(slack_user_id=uid))
19+
instance = db.session.add(User(slack_user_id = uid))
1720
db.session.commit()
1821
return instance
1922

2023
def update_points(self):
2124
helper = ErrorHelper()
22-
current_task_id = int(self.data.get("text"))
23-
current_slack_id = self.data.get("user_id")
25+
current_task_id = int(self.data.get('text'))
26+
current_slack_id = self.data.get('user_id')
2427

2528
# check if task id exists
26-
exists = db.session.query(
27-
db.exists().where(Task.task_id == current_task_id)
28-
).scalar()
29+
exists = db.session.query(db.exists().where(Task.task_id == current_task_id)).scalar()
2930

30-
task_progress = Assignment.query.filter_by(
31-
assignment_id=current_task_id, progress=0.0
32-
).all()
31+
task_progress = Assignment.query.filter_by(assignment_id=current_task_id, progress=0.0).all()
3332

3433
if exists is False:
35-
return helper.get_command_help("no_task_id")
34+
return helper.get_command_help("no_task_id")
3635

3736
# check if task is done
3837
elif exists is True and len(task_progress) == 0:
@@ -43,8 +42,6 @@ def update_points(self):
4342
my_query = self.get_or_create(current_slack_id)
4443
user_id = my_query.user_id
4544

46-
db.session.query(Assignment).filter_by(
47-
assignment_id=current_task_id
48-
).update(dict(progress=1.0, user_id=user_id))
45+
db.session.query(Assignment).filter_by(assignment_id=current_task_id).update(dict(progress=1.0, user_id=user_id))
4946
db.session.commit()
5047
return helper.get_command_help("task_done")

0 commit comments

Comments
 (0)