Skip to content

Conversation

@lsabor
Copy link
Contributor

@lsabor lsabor commented Oct 8, 2024

Must run:

questions = Question.objects.filter(
    zero_point=0, resolution_set_time__isnull=False
).exclude(
    resolution__in=["ambiguous", "annulled", "below_lower_bound", "above_upper_bound"]
)
for question in questions:
    resolution = float(question.resolution)
    zero_point, range_max, range_min = (
        question.zero_point,
        question.range_max,
        question.range_min,
    )
    deriv_ratio = (range_max - zero_point) / max((range_min - zero_point), 0.0000001)
    unscaled_location = (resolution - range_min) / (range_max - range_min)
    scaled_resolution = range_min + (range_max - range_min) * (
        deriv_ratio**unscaled_location - 1
    ) / (deriv_ratio - 1)
    question.resolution = str(scaled_resolution)
    question.save()

manually to fix incorrectly stored resolutions

@lsabor lsabor merged commit 3164236 into main Oct 8, 2024
@lsabor lsabor deleted the quickfix/scaling-with-zero-point branch October 8, 2024 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants