Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>
Display closed cycles
src/blueprints/cycles.py | 4 +++- src/templates/cycles.html | 10 ++++++++++
diff --git a/src/blueprints/cycles.py b/src/blueprints/cycles.py
index a3185f115c70c13fbc38d083cda33722254155f7..624abe4b980bc8ab98de54ecba7d60c3da4a1fff 100644
--- a/src/blueprints/cycles.py
+++ b/src/blueprints/cycles.py
@@ -12,7 +12,9 @@ @cycles.route('/', methods = ['GET', 'POST'])
def index():
if request.method == 'GET':
current_cycle = Cycle.query.filter_by(status = 'published').first()
- return render_template('cycles.html', current_cycle = current_cycle, title = "Ciclos - Feira Virtual Bem da Terra")
+
+ closed_cycles = Cycle.query.filter_by(status = 'delivered').all()
+ return render_template('cycles.html', current_cycle = current_cycle, closed_cycles = closed_cycles, title = "Ciclos - Feira Virtual Bem da Terra")
else:
return create(request.form)
diff --git a/src/templates/cycles.html b/src/templates/cycles.html
index c8a514c74f73e89babd87325259f564512cdcd62..ca7ab39098147a2a4138f0e4e99191621802888b 100644
--- a/src/templates/cycles.html
+++ b/src/templates/cycles.html
@@ -9,4 +9,14 @@ Ver ciclo
<a href="{{url_for('cycles.close', id = current_cycle.id)}}">Fechar ciclo</a>
</div>
</section>
+
+<section class="closed-cycles">
+ <h1>Ciclos passados</h1>
+ {% for cycle in closed_cycles %}
+ <div class="cycle">
+ <h2>{{ cycle.name }}</h2>
+ <em>Ciclo fechado em {{ cycle.delivery_end_at.strftime("%d/%m/%Y") }} </em>
+ </div>
+ {% endfor %}
+</section>
{% endblock %}