Esempio n. 1
0
def _get_expanded_card_data_for_resume(project: scoring_base.ScoringProject) \
        -> application_pb2.ResumeTips:
    resume_tips = project.list_application_tips()
    sorted_tips = sorted(resume_tips, key=lambda t: (-len(t.filters), random.random()))
    tips_proto = application_pb2.ResumeTips(
        qualities=[t for t in sorted_tips if t.type == application_pb2.QUALITY],
        improvements=[t for t in sorted_tips if t.type == application_pb2.CV_IMPROVEMENT])
    for tip in itertools.chain(tips_proto.qualities, tips_proto.improvements):
        tip.ClearField('type')
    return tips_proto
Esempio n. 2
0
    def get_expanded_card_data(self, project: scoring_base.ScoringProject) \
            -> application_pb2.InterviewTips:
        """Retrieve data for the expanded card."""

        interview_tips = project.list_application_tips()
        sorted_tips = sorted(interview_tips, key=lambda t: (-len(t.filters), random.random()))
        tips_proto = application_pb2.InterviewTips(
            qualities=[t for t in sorted_tips if t.type == application_pb2.QUALITY],
            preparations=[
                t for t in sorted_tips
                if t.type == application_pb2.INTERVIEW_PREPARATION])
        for tip in itertools.chain(tips_proto.qualities, tips_proto.preparations):
            tip.ClearField('type')
        return tips_proto