Fixed news never displaying a Start in prefix
This commit is contained in:
parent
c2f37b7e45
commit
30be7058cd
1 changed files with 8 additions and 7 deletions
|
@ -302,18 +302,19 @@ class NewsBlurb(QtWidgets.QWidget):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update_timer(self):
|
def update_timer(self):
|
||||||
|
prefix = ''
|
||||||
if self.news_info.get('startDate'):
|
if self.news_info.get('startDate'):
|
||||||
eta = round(time.mktime(time.strptime(self.news_info.get('startDate'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
eta = round(time.mktime(time.strptime(self.news_info.get('startDate'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
||||||
|
if eta > 0:
|
||||||
prefix = 'Starts in '
|
prefix = 'Starts in '
|
||||||
if self.news_info.get('endDate'):
|
if self.news_info.get('endDate') and not prefix:
|
||||||
eta = round(time.mktime(time.strptime(self.news_info.get('endDate'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
eta = round(time.mktime(time.strptime(self.news_info.get('endDate'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
||||||
|
if eta > 0:
|
||||||
prefix = 'Ends in '
|
prefix = 'Ends in '
|
||||||
if eta < 0:
|
|
||||||
prefix = ''
|
|
||||||
else:
|
else:
|
||||||
eta = round(time.mktime(time.strptime(self.news_info.get('date'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
eta = round(time.mktime(time.strptime(self.news_info.get('date'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
||||||
if abs(eta) // 86400 >= 1:
|
if abs(eta) // 86400 >= 1:
|
||||||
self.NewsBlurbRelTimer.setText(f'{prefix if eta // 86400 > 0 else ""}{abs(eta) // 86400}d')
|
self.NewsBlurbRelTimer.setText(f'{prefix}{abs(eta) // 86400}d')
|
||||||
else:
|
else:
|
||||||
self.NewsBlurbRelTimer.setText(f'{prefix if eta > 0 else ""}{(abs(eta) // 3600) % 24}h {(abs(eta) // 60) % 60}m')
|
self.NewsBlurbRelTimer.setText(f'{prefix}{(abs(eta) // 3600) % 24}h {(abs(eta) // 60) % 60}m')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue