|
12 | 12 |
|
13 | 13 | def get_grouping_info( |
14 | 14 | grouping_config: StrategyConfiguration, project: Project, event: Event | GroupEvent |
15 | | -) -> dict[str, dict[str, Any]]: |
| 15 | +) -> dict[str, Any]: |
16 | 16 | # We always fetch the stored hashes here. The reason for this is |
17 | 17 | # that we want to show in the UI if the forced grouping algorithm |
18 | 18 | # produced hashes that would normally also appear in the event. |
@@ -43,7 +43,7 @@ def _check_for_mismatched_hashes( |
43 | 43 | The result is stored with each variant and recorded as a metric. |
44 | 44 | """ |
45 | 45 |
|
46 | | - for variant_dict in grouping_info.values(): |
| 46 | + for variant_dict in grouping_info["variants"].values(): |
47 | 47 | hash_value = variant_dict["hash"] |
48 | 48 |
|
49 | 49 | # Since the hashes are generated on the fly and might no |
@@ -125,18 +125,29 @@ def get_grouping_info_from_variants_legacy( |
125 | 125 |
|
126 | 126 | def get_grouping_info_from_variants( |
127 | 127 | variants: dict[str, BaseVariant], |
128 | | -) -> dict[str, dict[str, Any]]: |
| 128 | +) -> dict[str, Any]: |
129 | 129 | """ |
130 | 130 | Given a dictionary of variant objects, create and return a copy of the dictionary in which each |
131 | 131 | variant object value has been transformed into an equivalent dictionary value, which knows the |
132 | 132 | key under which it lives. |
133 | 133 | """ |
134 | 134 |
|
135 | | - return { |
| 135 | + grouping_config_id = None |
| 136 | + for variant in variants.values(): |
| 137 | + grouping_config_id = variant.config.id if hasattr(variant, "config") else None |
| 138 | + if grouping_config_id: |
| 139 | + break |
| 140 | + |
| 141 | + variants_json = { |
136 | 142 | # Overwrite the description with a new, improved version |
137 | 143 | variant.key: { |
138 | 144 | **variant.as_dict(), |
139 | 145 | "description": _get_new_description(variant), |
140 | 146 | } |
141 | 147 | for variant in variants.values() |
142 | 148 | } |
| 149 | + |
| 150 | + return { |
| 151 | + "grouping_config": grouping_config_id, |
| 152 | + "variants": variants_json, |
| 153 | + } |
0 commit comments