Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrator/services/migrate_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def create_question(question: dict, **kwargs) -> Question:
created_at=question["created_time"],
edited_at=question["edited_time"],
open_time=question["publish_time"],
cp_reveal_time=question["publish_time"],
cp_reveal_time=question["cp_reveal_time"],
scheduled_close_time=(
question["close_time"]
if question["close_time"]
Expand Down
52 changes: 15 additions & 37 deletions migrator/services/migrate_scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,51 +88,29 @@ def score_questions(qty: int | None = None, start_id: int = 0):
)
print("Resolved q with no resolved time")
exit()
score_types = [
Score.ScoreTypes.PEER,
Score.ScoreTypes.BASELINE,
Score.ScoreTypes.SPOT_PEER,
]
if question.id in question_ids_to_relative_score:
score_types.append(Score.ScoreTypes.RELATIVE_LEGACY)
f = question.user_forecasts.count()
print(
f"\033[Kscoring question {i:>4}/{c} ID:{question.id:<4} forecasts:{f:<4} "
f"dur:{str(timezone.now() - start).split(".")[0]} "
f"est:{str((timezone.now() - start) / i * c).split(".")[0]} "
"peer...",
f"scoring: {','.join(score_types)}...",
end="\r",
)
score_question(
question,
question.resolution,
score_types=[
Score.ScoreTypes.PEER,
],
score_types=score_types,
)
print(
f"\033[Kscoring question {i:>4}/{c} ID:{question.id:<4} forecasts:{f:<4} "
f"dur:{str(timezone.now() - start).split(".")[0]} "
f"est:{str((timezone.now() - start) / i * c).split(".")[0]} "
"peer done. basline...",
end="\r",
)
score_question(
question,
question.resolution,
score_types=[
Score.ScoreTypes.BASELINE,
],
)
# TODO: add spot_forecast_time
if question.id in question_ids_to_relative_score:
if ArchivedScore.objects.filter(question=question).exists():
continue
print(
f"\033[Kscoring question {i:>4}/{c} ID:{question.id:<4} forecasts:{f:<4} "
f"dur:{str(timezone.now() - start).split(".")[0]} "
f"est:{str((timezone.now() - start) / i * c).split(".")[0]} "
"peer done. basline done. relative...",
end="\r",
)
score_question(
question,
question.resolution,
# TODO: add spot_forecast_time
score_types=[
Score.ScoreTypes.RELATIVE_LEGACY,
],
)
print(
f"\033[Kscoring question {i:>4}/{c} ID:{question.id:<4} forecasts:{f:<4} "
f"dur:{str(timezone.now() - start).split(".")[0]} "
f"est:{str((timezone.now() - start) / i * (c - i)).split(".")[0]} "
f"scoring: {','.join(score_types)}... DONE",
)
7 changes: 6 additions & 1 deletion questions/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ def resolve_question_and_send_notifications(question_id: int):
score_question(
question,
question.resolution,
score_types=[Score.ScoreTypes.PEER, Score.ScoreTypes.BASELINE],
score_types=[
Score.ScoreTypes.PEER,
Score.ScoreTypes.BASELINE,
Score.ScoreTypes.SPOT_PEER,
Score.ScoreTypes.RELATIVE_LEGACY,
],
)
scores = (
question.scores.filter(user__isnull=False)
Expand Down