from Matching.AbstractMatcher import AbstractMatcher


class SingleProjectMatcher(AbstractMatcher):
    def __init__(self, user, project):
        self.project = project
        super().__init__(user)

    def get_metric(self):
        umf = self._get_umf()
        age = umf.create_age_group_metric()
        interests = umf.create_interests_metric()
        liked_back = 1.2 if umf.create_liked_back_metric() else 1
        has_matches = umf.create_has_matches_metric()

        same_project = (age + interests) * (has_matches * liked_back)
        return same_project

    def query_users(self):
        # match over one common project
        # unmatchable user (matches likes dislikes) are filtered in Abstract Matcher
        return self.project.attendees
