예제 #1
0
def get_people(filters, page_size=25):
    q = Person.query
    q = add_person_leaderboard_filters(q)
    q = q.options(
        orm.subqueryload_all(
            Person.contributions,
            Contribution.package 
        )
    )
    for k, v in filters.iteritems():
        if k == "tags":
            pass # don't do anything for these for now for people
        else:
            if k == "host":
                k = "main_language"
                v = make_language(v)

            attr = getattr(Person, k)
            q = q.filter(attr==v)

    total_count = q.count()

    q = q.order_by(Person.impact.desc())
    q = q.limit(page_size)
    objects = q.all()
    return (total_count, objects)
예제 #2
0
def get_people(filters, page_size=25):
    q = Person.query
    q = add_person_leaderboard_filters(q)
    q = q.options(
        orm.subqueryload_all(
            Person.contributions,
            Contribution.package 
        )
    )
    for k, v in filters.iteritems():
        if k == "tags":
            pass # don't do anything for these for now for people
        else:
            if k == "host":
                k = "main_language"
                v = make_language(v)

            attr = getattr(Person, k)
            q = q.filter(attr==v)

    total_count = q.count()

    q = q.filter(Person.impact != None)
    q = q.order_by(Person.impact.desc())
    q = q.limit(page_size)
    objects = q.all()
    return (total_count, objects)
예제 #3
0
파일: tags.py 프로젝트: richard-orr/depsy
    def as_snippet(self):

        ret = {
        	"language": make_language(self.namespace),
        	"count": self.count,
            "count_academic": self.count_academic,
        	"name": self.unique_tag,
            "related_tags": self.related_tags
        }

        return ret