From c896767c66139d32422385bc463047a5db40a5bc Mon Sep 17 00:00:00 2001 From: Matthew Ragan Date: Fri, 5 May 2023 08:22:32 -0700 Subject: [PATCH] Fixes Issue with Malformed Journal In the case of a journal that contains only an image, but no additional information there is an chance that the resulting journal object will produce malformed ride object. This fix resolves this possible issue. --- project/_startDev.cmd | 3 --- project/td-python/CibicObjects/data_controller.py | 2 ++ project/td-python/Process/processEXT.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/project/_startDev.cmd b/project/_startDev.cmd index f3d753e..fb6ee50 100644 --- a/project/_startDev.cmd +++ b/project/_startDev.cmd @@ -26,9 +26,6 @@ for /f "tokens=2*" %%a in ('reg query "hkcr\TouchDesigner."%TOUCHVERSION%"\shell rem if we are in this part of the script, the TD version has not been found in the registry goto TDVERSIONNOTFOUND - - - :STARTPROJECT rem construct our run command - removes cmd arg param, concats toefile diff --git a/project/td-python/CibicObjects/data_controller.py b/project/td-python/CibicObjects/data_controller.py index fa63cca..a6f797f 100644 --- a/project/td-python/CibicObjects/data_controller.py +++ b/project/td-python/CibicObjects/data_controller.py @@ -263,6 +263,7 @@ def ProcessData(self, ride_data:list, journal_data:list) -> None: def Run(self, start=datetime(2022, 6, 1), end=datetime(2022, 8, 24), to_bin=False): self._Fetch(start, end) + self.raw_journals = filter(lambda x: x['journal'] is not None, self.raw_journals) self.ProcessData(self.raw_rides, self.raw_journals) for k, v in self._User_Map.items(): v.Match() @@ -297,6 +298,7 @@ def Load_from_cache(self, directory): self.raw_rides = combined['raw_rides'] self.raw_journals = combined['raw_journals'] + self.raw_journals = filter(lambda x: x['journal'] is not None, self.raw_journals) self.ProcessData(self.raw_rides, self.raw_journals) for k, v in self._User_Map.items(): v.Match() diff --git a/project/td-python/Process/processEXT.py b/project/td-python/Process/processEXT.py index 9d3eb66..a89059e 100644 --- a/project/td-python/Process/processEXT.py +++ b/project/td-python/Process/processEXT.py @@ -165,7 +165,7 @@ def Video_render_timer_cycle(self, timerOp:OP) -> None: # NOTE Mapbox and Ride Info def _get_mapbox_loaded(self:callable): - return Lookup.PROCESS.op("base_mapbox/MapboxTD").par.Loaded + return Lookup.PROCESS.op("base_mapbox/MapboxTD").par.Loaded def _rides_by_region(self:callable, region:str) -> list: '''Rides filtered by currently selected region @@ -180,7 +180,7 @@ def _rides_by_region(self:callable, region:str) -> list: region_rides = [ride for ride in all_rides if ride.region == region_str] rides_with_flows = [ride for ride in region_rides if ride.Flow.name != None] rides_with_journals = [ride for ride in rides_with_flows if ride.Reflection_data != None] - + # which list of rides do we output output_rides = rides_with_flows