예제 #1
0
파일: tokens.py 프로젝트: soartech/fluent
    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
예제 #2
0
    def _get_required_self_report(self) -> Optional[LearningActivity]:
        last_5_activities = utils.last_n_activities_attempted(
            self.learner.activity_attempt_counters, 5, self.query_cacher)

        # Self report required if user has not yet taken a self report after having taken a regular activity
        for activity in last_5_activities:
            if utils.educational_use_in_activity(
                    activity, MagicStrings.EducationalUses.SELF_REPORT):
                return None
            if not utils.educational_use_in_activity(
                    activity, MagicStrings.EducationalUses.ASSESSES):
                return self.query_cacher.get_self_report()
        return None
예제 #3
0
파일: tokens.py 프로젝트: soartech/fluent
    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
예제 #4
0
 def filter_capstone_activities(self, activities: List[LearningActivity]):
     return [
         activity for activity in activities
         if not utils.educational_use_in_activity(
             activity, MagicStrings.EducationalUses.CAPSTONE)
         or self.__class__.__name__ == TimeForCapstone.__class__.__name__
     ]
예제 #5
0
    def sort_activities(
            self,
            activities: List[LearningActivity]) -> List[LearningActivity]:
        educational_use_activities = OrderedDict({
            MagicStrings.EducationalUses.FIRST_TIME:
            list(),
            MagicStrings.EducationalUses.ASSESSES:
            list(),
            MagicStrings.EducationalUses.MORE_CONTENT:
            list(),
            MagicStrings.EducationalUses.REFERENCE:
            list(),
            MagicStrings.EducationalUses.TEAM:
            list(),
            "Other":
            list()
        })

        for activity in activities:
            for educational_use_key in educational_use_activities.keys():
                # Should only hit "other" here if no other educational uses were found.
                if (educational_use_key != "Other"
                        and utils.educational_use_in_activity(
                            activity, educational_use_key)
                    ) or educational_use_key == "Other":
                    educational_use_activities[educational_use_key].append(
                        activity)
                    break

        return_activities = list()
        # Should append in the order above because of the ordered dict
        for activity_list in educational_use_activities.values():
            return_activities += activity_list

        return return_activities
예제 #6
0
    def _get_required_check_on_learning_assessment(
            self) -> Optional[LearningActivity]:
        last_5_activities = utils.last_n_activities_attempted(
            self.learner.activity_attempt_counters, 5, self.query_cacher)
        for activity in last_5_activities:
            if utils.educational_use_in_activity(
                    activity, MagicStrings.EducationalUses.SELF_REPORT):
                continue
            if utils.educational_use_in_activity(
                    activity, MagicStrings.EducationalUses.ASSESSES):
                return None

            assessment_id = utils.get_check_on_learning_assessment_acitivity_id(
                activity)
            if assessment_id is not None:
                return self.query_cacher.get_activity(
                    utils.mongo_id_from_url(assessment_id))
        return None