Skip to content

Commit

Permalink
Merge pull request #173 from GliderGeek/potential-utc-fixes
Browse files Browse the repository at this point in the history
temporary fixes for uvalde wgc; need to figure out where permanent fi…
  • Loading branch information
GliderGeek authored Aug 29, 2024
2 parents bb088bd + 80a07ee commit 6a5d3fa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Master

[unreleased]
- convert UTC to local time to prevent timezone issues

v0.68.0 - 2024-08-18
- use macos-13 on github runner
Expand Down
12 changes: 12 additions & 0 deletions PySoar/analysis.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
from threading import Thread
import datetime

import wx
from opensoar.competition.soaringspot import SoaringSpotDaily
from opensoar.utilities.helper_functions import add_times

from exportClass import ExcelExport
from performanceClass import Performance
Expand Down Expand Up @@ -63,6 +65,15 @@ def run(self):
self.download_progress(None, None)
competition_day = daily_result_page.generate_competition_day(target_directory, self.download_progress)

# converting trace from UTC to local time
tz = competition_day.task.timezone
for competitor in competition_day.competitors:
for fix in competitor.trace:
fix['time'] = add_times(fix['time'], datetime.timedelta(hours=tz))

# converting start-time from UTC to local time
competition_day.task.start_opening = add_times(competition_day.task.start_opening, datetime.timedelta(hours=tz))

if competition_day.task.multistart:
txt = 'Multiple starting points not implemented!'
if self._notify_window is None:
Expand All @@ -79,6 +90,7 @@ def run(self):
for competitor in competition_day.competitors:

if competitor.competition_id in failed_comp_ids:
print('failed_comp_id:', failed_comp_ids)
continue
else:
try:
Expand Down
5 changes: 0 additions & 5 deletions PySoar/exportClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,6 @@ def write_perf_indics(self, leg, settings, competition_day):
content = competitor.performance.leg[leg][perf_ind]

if perf_ind in ['t_start', 't_finish']:

timezone = competition_day.task.timezone
if timezone is not None:
content = add_times(content, datetime.timedelta(hours=timezone))

content = content.strftime('%H:%M:%S')

style = self.style_dict[perf_format + self.style_addition(leg, perf_ind, competitor.competition_id)]
Expand Down

0 comments on commit 6a5d3fa

Please sign in to comment.