Skip to content

Commit

Permalink
quickfix build_forecasts tweaks for consistency (#1860)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsabor authored Dec 31, 2024
1 parent 26e4280 commit 3b50a86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion questions/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def build_question_forecasts(
)[aggregation_method]

# overwrite old history with new history, minimizing the amount deleted and created
previous_history = question.aggregate_forecasts.filter(method=aggregation_method)
previous_history = question.aggregate_forecasts.filter(
method=aggregation_method
).order_by("start_time")
to_overwrite, to_delete = (
previous_history[: len(aggregation_history)],
previous_history[len(aggregation_history) :],
Expand Down
6 changes: 5 additions & 1 deletion utils/the_math/aggregations.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ def get_aggregation_history(
full_summary: dict[AggregationMethod, list[AggregateForecast]] = dict()

# get input forecasts
forecasts = question.user_forecasts.order_by("start_time").select_related("author")
forecasts = (
Forecast.objects.filter(question_id=question.id)
.order_by("start_time")
.select_related("author")
)

if user_ids:
forecasts = forecasts.filter(author_id__in=user_ids)
Expand Down

0 comments on commit 3b50a86

Please sign in to comment.