Example #1
0
def _merge_users(target, source, **kwargs):
    from indico.modules.events.papers.models.comments import PaperReviewComment
    from indico.modules.events.papers.models.competences import PaperCompetence
    from indico.modules.events.papers.models.reviews import PaperReview
    from indico.modules.events.papers.models.revisions import PaperRevision
    PaperReviewComment.query.filter_by(user_id=source.id).update({PaperReviewComment.user_id: target.id})
    PaperReviewComment.query.filter_by(modified_by_id=source.id).update({PaperReviewComment.modified_by_id: target.id})
    PaperReview.query.filter_by(user_id=source.id).update({PaperReview.user_id: target.id})
    PaperRevision.query.filter_by(submitter_id=source.id).update({PaperRevision.submitter_id: target.id})
    PaperRevision.query.filter_by(judge_id=source.id).update({PaperRevision.judge_id: target.id})
    PaperCompetence.merge_users(target, source)
    target.judge_for_contributions |= source.judge_for_contributions
    source.judge_for_contributions.clear()
    target.content_reviewer_for_contributions |= source.content_reviewer_for_contributions
    source.content_reviewer_for_contributions.clear()
    target.layout_reviewer_for_contributions |= source.layout_reviewer_for_contributions
    source.layout_reviewer_for_contributions.clear()
Example #2
0
def _merge_users(target, source, **kwargs):
    from indico.modules.events.papers.models.comments import PaperReviewComment
    from indico.modules.events.papers.models.competences import PaperCompetence
    from indico.modules.events.papers.models.reviews import PaperReview
    from indico.modules.events.papers.models.revisions import PaperRevision
    PaperReviewComment.query.filter_by(user_id=source.id).update({PaperReviewComment.user_id: target.id})
    PaperReviewComment.query.filter_by(modified_by_id=source.id).update({PaperReviewComment.modified_by_id: target.id})
    PaperReview.query.filter_by(user_id=source.id).update({PaperReview.user_id: target.id})
    PaperRevision.query.filter_by(submitter_id=source.id).update({PaperRevision.submitter_id: target.id})
    PaperRevision.query.filter_by(judge_id=source.id).update({PaperRevision.judge_id: target.id})
    PaperCompetence.merge_users(target, source)
    target.judge_for_contributions |= source.judge_for_contributions
    source.judge_for_contributions.clear()
    target.content_reviewer_for_contributions |= source.content_reviewer_for_contributions
    source.content_reviewer_for_contributions.clear()
    target.layout_reviewer_for_contributions |= source.layout_reviewer_for_contributions
    source.layout_reviewer_for_contributions.clear()
Example #3
0
def create_competences(event, user, competences):
    PaperCompetence(event=event, user=user, competences=competences)
    logger.info("Competences for user %r for event %r created by %r", user,
                event, session.user)
    event.log(EventLogRealm.reviewing,
              EventLogKind.positive,
              'Papers',
              f"Added competences of {user.full_name}",
              session.user,
              data={'Competences': ', '.join(competences)})
Example #4
0
 def _migrate_competences(self):
     competence_map = {}
     for avatar, competences in self.pr._userCompetences.viewitems():
         if avatar.user.id in competence_map:
             # add to existing list, which SQLAlchemy will commit
             competence_map[avatar.user.id] += competences
         elif competences:
             competence_map[avatar.user.id] = competences
             competence = PaperCompetence(user=avatar.user,
                                          competences=competences)
             self.event.paper_competences.append(competence)