@@ -908,18 +908,13 @@ def test_profile_selection_routes_vescdash_other_activity_to_onewheel(self) -> N
908908 "priority" : 79 ,
909909 "criteria" : {
910910 "kind" : "activity" ,
911- "any_of" : [
911+ "all_of" : [
912+ {"garmin_activity_type_in" : ["other" ]},
912913 {
913- "all_of" : [
914- {"garmin_activity_type_in" : ["other" ]},
915- {
916- "garmin_connectiq_app_ids_any" : [
917- "0432631a-d5e3-4272-a072-fa8c7e24c483" ,
918- ]
919- },
914+ "garmin_connectiq_app_ids_any" : [
915+ "0432631a-d5e3-4272-a072-fa8c7e24c483" ,
920916 ]
921917 },
922- {"text_contains_any" : ["onewheel" , "euc" , "electric unicycle" ]},
923918 ],
924919 },
925920 },
@@ -962,18 +957,13 @@ def test_profile_selection_does_not_route_run_to_onewheel_without_aligned_garmin
962957 "priority" : 79 ,
963958 "criteria" : {
964959 "kind" : "activity" ,
965- "any_of" : [
960+ "all_of" : [
961+ {"garmin_activity_type_in" : ["other" ]},
966962 {
967- "all_of" : [
968- {"garmin_activity_type_in" : ["other" ]},
969- {
970- "garmin_connectiq_app_ids_any" : [
971- "0432631a-d5e3-4272-a072-fa8c7e24c483" ,
972- ]
973- },
963+ "garmin_connectiq_app_ids_any" : [
964+ "0432631a-d5e3-4272-a072-fa8c7e24c483" ,
974965 ]
975966 },
976- {"text_contains_any" : ["onewheel" , "euc" , "electric unicycle" ]},
977967 ],
978968 },
979969 },
@@ -998,6 +988,55 @@ def test_profile_selection_does_not_route_run_to_onewheel_without_aligned_garmin
998988
999989 self .assertEqual (selected .get ("profile_id" ), "default" )
1000990
991+ def test_profile_selection_does_not_route_mutated_onewheel_title_when_garmin_alignment_is_running (self ) -> None :
992+ settings = SimpleNamespace (
993+ profile_trail_gain_per_mile_ft = 220.0 ,
994+ profile_long_run_miles = 10.0 ,
995+ home_latitude = None ,
996+ home_longitude = None ,
997+ home_radius_miles = 10.0 ,
998+ )
999+ profiles = [
1000+ {"profile_id" : "default" , "label" : "Default" , "enabled" : True , "priority" : 0 },
1001+ {
1002+ "profile_id" : "onewheel" ,
1003+ "label" : "Onewheel" ,
1004+ "enabled" : True ,
1005+ "priority" : 79 ,
1006+ "criteria" : {
1007+ "kind" : "activity" ,
1008+ "all_of" : [
1009+ {"garmin_activity_type_in" : ["other" ]},
1010+ {
1011+ "garmin_connectiq_app_ids_any" : [
1012+ "0432631a-d5e3-4272-a072-fa8c7e24c483" ,
1013+ ]
1014+ },
1015+ ],
1016+ },
1017+ },
1018+ ]
1019+ activity = {
1020+ "sport_type" : "EBikeRide" ,
1021+ "type" : "EBikeRide" ,
1022+ "name" : "Onewheel Float 🛹" ,
1023+ "description" : "🛞 Onewheel ride on the N/A" ,
1024+ "distance" : 1622.0 ,
1025+ "moving_time" : 645 ,
1026+ }
1027+ training = {
1028+ "_garmin_activity_aligned" : True ,
1029+ "garmin_last_activity" : {
1030+ "activity_type" : "running" ,
1031+ "connectiq_app_ids" : [],
1032+ },
1033+ }
1034+
1035+ with patch ("chronicle.activity_pipeline.list_template_profiles" , return_value = profiles ):
1036+ selected = _select_activity_profile (settings , activity , training = training )
1037+
1038+ self .assertEqual (selected .get ("profile_id" ), "default" )
1039+
10011040
10021041class TestExecutableProfileCriteria (unittest .TestCase ):
10031042 def setUp (self ) -> None :
0 commit comments