@@ -161,6 +161,48 @@ def test_description_context_exposes_activity_badges(self) -> None:
161161 self .assertEqual (context .get ("smashrun_activity_badges" ), ["Two by 365 by 10k" ])
162162 self .assertEqual (context .get ("smashrun" , {}).get ("activity_badges" ), ["Two by 365 by 10k" ])
163163
164+ def test_description_context_uses_aligned_garmin_activity_hr_and_cadence (self ) -> None :
165+ context = _build_description_context (
166+ detailed_activity = {
167+ "id" : 17455368360 ,
168+ "name" : "Lunch Run" ,
169+ "type" : "Run" ,
170+ "sport_type" : "Run" ,
171+ "distance" : 8046.72 ,
172+ "moving_time" : 2400 ,
173+ "elapsed_time" : 2460 ,
174+ "average_speed" : 3.3528 ,
175+ "average_heartrate" : 151 ,
176+ "average_cadence" : 88.0 ,
177+ "start_latlng" : [33.75 , - 84.39 ],
178+ },
179+ training = {
180+ "average_hr" : 143 ,
181+ "running_cadence" : 176 ,
182+ "_garmin_activity_aligned" : True ,
183+ "garmin_last_activity" : {
184+ "activity_id" : 3002 ,
185+ "average_hr" : 167 ,
186+ "cadence_spm" : 182 ,
187+ },
188+ "garmin_segment_notables" : [],
189+ },
190+ intervals_payload = {},
191+ week = {"gap" : "8:00/mi" , "distance" : 10.0 , "elevation" : 100.0 , "duration" : "1:20:00" , "beers_earned" : 6.0 , "calories" : 1000 , "run_count" : 2 },
192+ month = {"gap" : "8:10/mi" , "distance" : 40.0 , "elevation" : 400.0 , "duration" : "5:20:00" , "beers_earned" : 25.0 , "calories" : 4000 , "run_count" : 8 },
193+ year = {"gap" : "8:20/mi" , "distance" : 80.0 , "elevation" : 800.0 , "duration" : "10:40:00" , "beers_earned" : 50.0 , "calories" : 8000 , "run_count" : 16 },
194+ longest_streak = None ,
195+ notables = [],
196+ latest_elevation_feet = None ,
197+ misery_index = None ,
198+ misery_index_description = None ,
199+ air_quality_index = None ,
200+ aqi_description = None ,
201+ )
202+
203+ self .assertEqual (context .get ("activity" , {}).get ("average_hr" ), 167 )
204+ self .assertEqual (context .get ("activity" , {}).get ("cadence_spm" ), 182 )
205+
164206
165207class TestActivitySmashrunBadges (unittest .TestCase ):
166208 def test_extract_activity_smashrun_badges_matches_smashrun_and_strava_ids (self ) -> None :
0 commit comments