Ejemplo n.º 1
0
import math
import consts
from exercises.accuracy_model import AccuracyModel

MIN_STREAK_TILL_PROFICIENCY = AccuracyModel.min_streak_till_threshold(
    consts.PROFICIENCY_ACCURACY_THRESHOLD)


# user_exercise is a user_exercise object
# suggested and proficient are both bools
#
# offset is used to derive a point value for the nth + offset problem
# (i.e. to get the current or last point value)
#
# with offset = 0, ExercisePointCalculator yields the point value for
# the *next* correct exercise.
#
# with offset = -1, ExercisePointCalculator yields the point value for
# the last correct exercise.
def ExercisePointCalculator(user_exercise, topic_mode, suggested, proficient,
                            offset=0):

    points = 0

    required_streak = MIN_STREAK_TILL_PROFICIENCY
    degrade_threshold = (required_streak
                         + consts.DEGRADING_EXERCISES_AFTER_PROFICIENCY)

    if user_exercise.longest_streak + offset <= required_streak:
        # Have never hit a streak, higher base than normal
        points = consts.INCOMPLETE_EXERCISE_POINTS_BASE
 def sim(self, str_sequence):
     gen = TestSequenceFunctions.to_bool_generator(str_sequence)
     return AccuracyModel.simulate(gen)
 def model_from_str(str_sequence):
     model = AccuracyModel()
     model.update(TestSequenceFunctions.to_bool_generator(str_sequence))
     return model
Ejemplo n.º 4
0
 def sim(self, str_sequence):
     gen = TestSequenceFunctions.to_bool_generator(str_sequence)
     return AccuracyModel.simulate(gen)
Ejemplo n.º 5
0
 def model_from_str(str_sequence):
     model = AccuracyModel()
     model.update(TestSequenceFunctions.to_bool_generator(str_sequence))
     return model
Ejemplo n.º 6
0
import math
import consts
from exercises.accuracy_model import AccuracyModel

MIN_STREAK_TILL_PROFICIENCY = AccuracyModel.min_streak_till_threshold(
    consts.PROFICIENCY_ACCURACY_THRESHOLD)


# user_exercise is a user_exercise object
# suggested and proficient are both bools
#
# offset is used to derive a point value for the nth + offset problem
# (i.e. to get the current or last point value)
#
# with offset = 0, ExercisePointCalculator yields the point value for
# the *next* correct exercise.
#
# with offset = -1, ExercisePointCalculator yields the point value for
# the last correct exercise.
def ExercisePointCalculator(user_exercise,
                            topic_mode,
                            suggested,
                            proficient,
                            offset=0):

    points = 0

    required_streak = MIN_STREAK_TILL_PROFICIENCY
    degrade_threshold = (required_streak +
                         consts.DEGRADING_EXERCISES_AFTER_PROFICIENCY)