Skip to content

Commit 1cb6685

Browse files
committed
Refactoring
1 parent c4067b4 commit 1cb6685

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

job_compassplus/parse_jira_Assigned_Open_Issues_per_Project/get_assigned_open_issues_per_project.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
def get_assigned_open_issues_per_project() -> dict[str, int]:
2121
rs = session.get(URL)
22+
rs.raise_for_status()
23+
2224
root = BeautifulSoup(rs.content, "html.parser")
2325

2426
data = dict()

job_compassplus/parse_jira_Assigned_Open_Issues_per_Project/gui.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def log_uncaught_exceptions(ex_cls, ex, tb):
5555
sys.excepthook = log_uncaught_exceptions
5656

5757

58-
WINDOW_TITLE = DIR.name
58+
WINDOW_TITLE: str = DIR.name
59+
DATE_FORMAT: str = "%d/%m/%Y"
5960

6061

6162
def get_table_widget(header_labels: list) -> QTableWidget:
@@ -116,7 +117,7 @@ def refresh(self, items: list[Run]):
116117
for i, run in enumerate(items):
117118
self.table_run.setRowCount(self.table_run.rowCount() + 1)
118119

119-
item = QTableWidgetItem(run.date.strftime("%d/%m/%Y"))
120+
item = QTableWidgetItem(run.date.strftime(DATE_FORMAT))
120121
item.setData(Qt.UserRole, run.get_project_by_issue_numbers())
121122
self.table_run.setItem(i, 0, item)
122123

@@ -219,11 +220,11 @@ def refresh(self):
219220

220221

221222
class MyChartViewToolTips(ChartViewToolTips):
222-
def __init__(self, timestamp_by_run: dict):
223+
def __init__(self, timestamp_by_run: dict[int, Run]):
223224
super().__init__()
224225

225226
self._callout_font_family = "Courier"
226-
self.timestamp_by_run = timestamp_by_run
227+
self.timestamp_by_run: dict[int, Run] = timestamp_by_run
227228

228229
def show_series_tooltip(self, point, state: bool):
229230
# value -> pos
@@ -245,10 +246,16 @@ def show_series_tooltip(self, point, state: bool):
245246
)
246247

247248
if current_distance < distance:
248-
date_value = int(p_value.x())
249-
run = self.timestamp_by_run[date_value]
249+
time_ms = int(p_value.x())
250+
run = self.timestamp_by_run[time_ms]
250251
table = get_table(run.get_project_by_issue_numbers())
251-
text = f"Total issues: {run.get_total_issues()}\n\n{table}"
252+
text = (
253+
f"{date.fromtimestamp(time_ms / 1000).strftime(DATE_FORMAT)}"
254+
"\n\n"
255+
f"Total issues: {run.get_total_issues()}"
256+
"\n"
257+
f"{table}"
258+
)
252259

253260
self._tooltip.setText(text)
254261
self._tooltip.setAnchor(p_value)
@@ -269,7 +276,7 @@ def __init__(self):
269276
icon = QIcon(file_name)
270277
self.setWindowIcon(icon)
271278

272-
self.timestamp_by_run = dict()
279+
self.timestamp_by_run: dict[int, Run] = dict()
273280

274281
menu = QMenu()
275282
menu.addAction("Show / hide", (lambda: self.setVisible(not self.isVisible())))

0 commit comments

Comments
 (0)