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)
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)
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