def get(): """ Return an movie key information based on his name """ movie = MovieRepository.getAll() result = [] for m in movie : d = {} d['name'] = m.name d['year'] = m.year d['genre'] = m.genre d['notes'] = 0 d['affiche'] = m.affiche t =[] for l in m.notes : t.append(l.note) if len(t) != 0 : d['notes'] = sum(t)/len(t) else : d['notes'] = -1 result.append((d)) return(jsonify([l for l in result]))
def get(): """ Return an movie key information based on his name """ movie = MovieRepository.getAll() result = [] for m in movie: d = {} d['name'] = m.name d['year'] = m.year d['genre'] = m.genre d['notes'] = 0 d['affiche'] = m.affiche t = [] for l in m.notes: t.append([l.note, l.username]) c = 0 if len(t) != 0: for i in t: c += i[0] d['notes'] = c / len(t) else: d['notes'] = -1 d['liste notes'] = t result.append((d)) return (jsonify([l for l in result]))