Example #1
0
    def activity_metadata_tokens(self, elo: str, activity: LearningActivity):
        point_sum = 0
        if educational_use_in_activity(
                activity, MagicStrings.EducationalUses.MORE_CONTENT):
            point_sum += self.MED_RAND_REWARD
        elif educational_use_in_activity(
                activity, MagicStrings.EducationalUses.REFERENCE):
            point_sum += self.LOW_RAND_REWARD

        if has_challenge_level(elo, activity,
                               MagicStrings.ChallengeLevels.COMPLEX):
            point_sum += self.MED_RAND_REWARD
        elif has_challenge_level(elo, activity,
                                 MagicStrings.ChallengeLevels.MODERATE):
            point_sum += self.LOW_RAND_REWARD

        if activity.interactivity_type == MagicStrings.InteractivityTypes.PASSIVE:
            point_sum += self.MED_RAND_OPTIONAL_REWARD
        elif activity.interactivity_type == MagicStrings.InteractivityTypes.LIMITED_PARTICIPATION:
            point_sum += self.LOW_RAND_OPTIONAL_REWARD

        if timedelta(minutes=10) < isodate.parse_duration(
                activity.time_required) < timedelta(minutes=30):
            point_sum += self.LOW_RAND_OPTIONAL_REWARD
        elif isodate.parse_duration(
                activity.time_required) > timedelta(minutes=30):
            point_sum += self.MED_RAND_OPTIONAL_REWARD

        return point_sum
Example #2
0
    def learner_behavior_tokens(self, activity: LearningActivity,
                                mastery_estimate: str,
                                last_activity: Optional[LearningActivity]):
        point_sum = 0
        if educational_use_in_activity(activity,
                                       MagicStrings.EducationalUses.ASSESSES):
            if mastery_estimate == MagicStrings.MasteryEstimates.NOT_HELD:
                point_sum += self.LOW_REWARD
            elif mastery_estimate == MagicStrings.MasteryEstimates.FORGOT:
                point_sum += self.MED_RAND_REWARD
        else:
            if has_learner_seen_activity(self.learner, activity):
                point_sum += self.HIGH_RAND_REWARD
            else:
                if mastery_estimate == MagicStrings.MasteryEstimates.FORGOT:
                    point_sum += self.MEDIUM_REWARD

        # Last activity completed was hard
        if last_activity is not None:
            last_elo = get_aligned_elo(last_activity)
            if has_challenge_level(last_elo, activity,
                                   MagicStrings.ChallengeLevels.COMPLEX):
                point_sum += self.LOW_RAND_OPTIONAL_REWARD

        return point_sum
Example #3
0
    def instantiate_row(
            self, elo: Competency,
            elo_activities: List[LearningActivity]) -> RecommendationRow:
        elo_activities = [
            activity for activity in elo_activities
            if (activity.interactivity_type ==
                utils.MagicStrings.InteractivityTypes.COMPLEX_PARTICIPATION
                or activity.interactivity_type ==
                utils.MagicStrings.InteractivityTypes.LIMITED_PARTICIPATION)
            and (utils.has_challenge_level(
                elo.id, activity, utils.MagicStrings.ChallengeLevels.MODERATE
            ) or utils.has_challenge_level(
                elo.id, activity, utils.MagicStrings.ChallengeLevels.COMPLEX))
        ]

        return self.recommendation_row(
            activities=elo_activities,
            strategy_name="Challenging and Interactive")
Example #4
0
 def instantiate_row(
         self, elo: Competency,
         elo_activities: List[LearningActivity]) -> RecommendationRow:
     elo_activities = [
         activity for activity in elo_activities
         if utils.has_challenge_level(
             elo.id, activity, utils.MagicStrings.ChallengeLevels.SIMPLE)
     ]
     return self.recommendation_row(activities=elo_activities,
                                    strategy_name="Introductory")
Example #5
0
 def instantiate_row(
         self, elo: Competency,
         elo_activities: List[LearningActivity]) -> RecommendationRow:
     elo_activities = [
         activity for activity in elo_activities
         if activity.interactivity_type == utils.MagicStrings.
         InteractivityTypes.PASSIVE and utils.has_challenge_level(
             elo.id, activity, utils.MagicStrings.ChallengeLevels.SIMPLE)
     ]
     return self.recommendation_row(activities=elo_activities,
                                    strategy_name="Essential Activities")
Example #6
0
def handle_activities(activities: List[LearningActivity]):
    for activity in activities:
        aligned_elo_id = get_aligned_elo(activity)
        if activity.interactivity_type == "Passive" and has_challenge_level(
                aligned_elo_id, activity, MagicStrings.ChallengeLevels.SIMPLE):
            print(activity.metadata_file)