示例#1
0
def edit_person(person_id):
    p = session.query(Person).get(person_id)
    img = (session.query(Image).from_statement(text('SELECT * '
                                                    'FROM image '
                                                    '   INNER JOIN images_people '
                                                    '    ON image.ImageId = images_people.ImageId '
                                                    '   INNER JOIN person ON images_people.PersonId = person.PersonId '
                                                    ' WHERE person.PersonId = {0}'
                                                    ' ORDER BY RANDOM()'.format(person_id))).first()).File_Path
    instagram_feed = get_instagram(p.InstagramUserName)
    if not instagram_feed:
        instagram_feed = []

    num_images = Stats.get_images_with_person(p.PersonId)
    percentage = Stats.get_images_with_person_percent(p.PersonId)
    ranking = Stats.get_person_ranking(p.PersonId)

    return render_template('people/editPerson.jade', title='Edit ' + p.Name,
                           person=p,
                           instagram=instagram_feed,
                           img=img,
                           images=num_images,
                           percentage=percentage,
                           ranking=ranking)
示例#2
0
 def test_get_people_ranking(self):
     person = 1
     result = Stats.get_person_ranking(person)
     self.assertIsNotNone(result)