Esempio n. 1
0
 def get():
     """ Return all movies in database """
     movies = [movie.json for movie in MovieRepository.get_all()]
     for movie in movies:
         movie["average_mark"] = MovieMeanResource.get(
             movie["movie_id"]).json["average_mark"]
     sorted_movies = sorted(movies,
                            key=lambda movie: movie["average_mark"],
                            reverse=True)
     return jsonify({"movies": sorted_movies})
Esempio n. 2
0
 def get():
     """ Return all movies """
     movies = MovieRepository.get_all()
     return [movie.json for movie in movies]