Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复个人生涯页面KDA计算结果仅在部分情况下显示的问题(Bug?Feature?) #502

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions app/view/career_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, parent=None):
self.tr('games)'))
self.winsLabel = ColorLabel(self.tr("Wins:") + " None", 'win')
self.lossesLabel = ColorLabel(self.tr("Losses:") + " None", 'lose')
self.kdaLabel = QLabel(self.tr("KDA:") + " None / None / None")
self.kdaLabel = QLabel(self.tr("KDA:") + " None / None / None" + self.tr("(") + "0" + self.tr(")"))
self.championsCard = ChampionsCard()
self.recentTeamButton = PushButton(self.tr("Recent teammates"))
self.filterComboBox = ComboBox()
Expand Down Expand Up @@ -555,8 +555,11 @@ def __onfilterComboBoxChanged(self, index):
)
self.winsLabel.setText(f"{self.tr('Wins:')} {wins}")
self.lossesLabel.setText(f"{self.tr('Losses:')} {losses}")
self.kdaLabel.setText(
f"{self.tr('KDA:')} {kills} / {deaths} / {assists}")
kda = f"{self.tr('KDA:')} {kills} / {deaths} / {assists}"
kda += self.tr("(")
kda += f"{(kills + assists) / (1 if deaths == 0 else deaths):.1f}"
kda += self.tr(")")
self.kdaLabel.setText(kda)

self.gameInfoLayout.addSpacerItem(
QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding))
Expand Down Expand Up @@ -645,8 +648,8 @@ def updateSummoners(self, info):
spacing = self.infopageVBoxLayout.spacing()

if length < 5:
self.infopageVBoxLayout.addStretch(5-length)
self.infopageVBoxLayout.addSpacing(spacing * (5-length))
self.infopageVBoxLayout.addStretch(5 - length)
self.infopageVBoxLayout.addSpacing(spacing * (5 - length))

def setLoadingPageEnabled(self, enable):
index = 0 if enable else 1
Expand Down
Loading