@@ -136,22 +136,22 @@ def get_total_events_count(organisation) -> int: # type: ignore[no-untyped-def]
136136def get_feature_evaluation_data (
137137 feature : Feature ,
138138 environment_id : int ,
139- period : int = 30 ,
139+ period_days : int = 30 ,
140140 labels_filter : Labels | None = None ,
141141) -> List [FeatureEvaluationData ]:
142142 if settings .USE_POSTGRES_FOR_ANALYTICS :
143143 return get_feature_evaluation_data_from_local_db (
144144 feature = feature ,
145145 environment_id = environment_id ,
146- period = period ,
146+ period_days = period_days ,
147147 labels_filter = labels_filter ,
148148 )
149149
150150 if settings .INFLUXDB_TOKEN :
151151 return get_feature_evaluation_data_from_influxdb (
152152 feature_name = feature .name ,
153153 environment_id = environment_id ,
154- period = f" { period } d" ,
154+ period_days = period_days ,
155155 labels_filter = labels_filter ,
156156 )
157157
@@ -162,15 +162,15 @@ def get_feature_evaluation_data(
162162def get_feature_evaluation_data_from_local_db (
163163 feature : Feature ,
164164 environment_id : int ,
165- period : int = 30 ,
165+ period_days : int = 30 ,
166166 labels_filter : Labels | None = None ,
167167) -> List [FeatureEvaluationData ]:
168168 filter = Q (
169169 environment_id = environment_id ,
170170 bucket_size = constants .ANALYTICS_READ_BUCKET_SIZE ,
171171 feature_name = feature .name ,
172172 created_at__date__lte = timezone .now (),
173- created_at__date__gt = timezone .now () - timedelta (days = period ),
173+ created_at__date__gt = timezone .now () - timedelta (days = period_days ),
174174 )
175175 if labels_filter :
176176 filter &= Q (labels__contains = labels_filter )
@@ -197,7 +197,12 @@ def _get_environment_ids_for_org(organisation: Organisation) -> list[int]:
197197 # references the environments and projects tables,
198198 # as they do not exist in the analytics database.
199199 return [
200- e .id for e in Environment .objects .filter (project__organisation = organisation )
200+ * Environment .objects .filter (
201+ project__organisation = organisation ,
202+ ).values_list (
203+ "id" ,
204+ flat = True ,
205+ )
201206 ]
202207
203208
0 commit comments