Example #1
0
    def add_email_data(self, feed_oid, resume_oids):
        if not resume_oids:
            return False

        feed = Feed2.objects(id=feed_oid)[0]
        email = feed.username
        pub_admin = self.request.user.username

        email_feed = EmailFeedData.objects(
            feed=feed_oid,
            is_send=False,
        ).first()

        if email_feed:
            EmailFeedData.objects(
                feed=feed_oid,
                is_send=False,
            ).update(
                set__pub_admin=pub_admin,
                add_to_set__resumes=resume_oids,
            )
        else:
            email_feed = EmailFeedData(
                email=email,
                pub_admin=pub_admin,
                feed=feed_oid,
                resumes=resume_oids,
            )
        email_feed.save()
        return True
def convert2pub_data(feed):
    username = feed.username
    feed_oid = feed.id

    feed_results = FeedResult.objects(
        feed=feed_oid,
        calc_time__gte=CONVERT_CACU_TIME,
        published=True,
    )

    if not feed_results:
        return False

    FeedCacheUtils.add_feed_id_update_cache(feed_oid)

    pub_admin = '*****@*****.**'
    resumes = [fr.resume.id for fr in feed_results]

    email_feed = EmailFeedData.objects(
        feed=feed_oid,
        is_send=False,
    ).first()

    if email_feed:
        EmailFeedData.objects(
            feed=feed_oid,
            is_send=False,
        ).update(
            set__pub_admin=pub_admin,
            add_to_set__resumes=resumes,
        )
    else:
        email_feed = EmailFeedData(
            email=username,
            pub_admin=pub_admin,
            feed=feed_oid,
            resumes=resumes,
        )
    email_feed.save()
def convert2pub_data(feed):
    username = feed.username
    feed_oid = feed.id

    feed_results = FeedResult.objects(
        feed=feed_oid,
        calc_time__gte=CONVERT_CACU_TIME,
        published=True,
    )

    if not feed_results:
        return False

    FeedCacheUtils.add_feed_id_update_cache(feed_oid)

    pub_admin = '*****@*****.**'
    resumes = [fr.resume.id for fr in feed_results]

    email_feed = EmailFeedData.objects(
        feed=feed_oid,
        is_send=False,
    ).first()

    if email_feed:
        EmailFeedData.objects(
            feed=feed_oid,
            is_send=False,
        ).update(
            set__pub_admin=pub_admin,
            add_to_set__resumes=resumes,
        )
    else:
        email_feed = EmailFeedData(
            email=username,
            pub_admin=pub_admin,
            feed=feed_oid,
            resumes=resumes,
        )
    email_feed.save()