Closed AnointingMax closed 3 years ago
There is a need for the second one The first one only happens when the it's the owner accessing the route so it has statuses while the other is is for when other people access the route hence the lack of statuses
On Tue, 9 Mar 2021, 21:00 Emmanuel Segun-Lean, notifications@github.com wrote:
@LeanKhan commented on this pull request. In app/routes.py https://github.com/bubbl-oss/evoting/pull/48#discussion_r590676462: try: check if the status of the election is pending if election.status == statuses[0]: check if the current time is greater than the starting time of the election if yes set the status of the election to started if election.starting_at < now: election.status_id = 2 check if the status of the election is started elif election.status == statuses[1]: check if the current time is greater than the ending time of the election if yes set the status of the election to ended if election.ending_at < now: election.status_id = 3 except Exception as e: print(str(e)) try: db.session.commit() except Exception as e: Nice work with the try...except and roll backs. In app/routes.py https://github.com/bubbl-oss/evoting/pull/48#discussion_r590677683: @@ -107,8 +107,8 @@ def election(link): return redirect(url_for('missing_route')) if election.owner.id == current_user.id: statuses = Status.query.all() return render_template('election.html', title=election.name, election=election, statuses=statuses) return render_template('election.html', title=election.name, election=election, statuses=statuses) return render_template('election.html', title=election.name, election=election) No need for the second render_template I think — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bubbl-oss/evoting/pull/48#pullrequestreview-607876529, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRZIWJV3NCOYOEJHQYWPYTTCZ447ANCNFSM4Y3ZYHZQ .
In app/routes.py https://github.com/bubbl-oss/evoting/pull/48#discussion_r590676462:
try: check if the status of the election is pending if election.status == statuses[0]: check if the current time is greater than the starting time of the election if yes set the status of the election to started if election.starting_at < now: election.status_id = 2 check if the status of the election is started elif election.status == statuses[1]: check if the current time is greater than the ending time of the election if yes set the status of the election to ended if election.ending_at < now: election.status_id = 3 except Exception as e: print(str(e)) try: db.session.commit() except Exception as e:
In app/routes.py https://github.com/bubbl-oss/evoting/pull/48#discussion_r590677683:
@@ -107,8 +107,8 @@ def election(link): return redirect(url_for('missing_route')) if election.owner.id == current_user.id: statuses = Status.query.all() return render_template('election.html', title=election.name, election=election, statuses=statuses) return render_template('election.html', title=election.name, election=election, statuses=statuses) return render_template('election.html', title=election.name, election=election)
@@ -107,8 +107,8 @@ def election(link): return redirect(url_for('missing_route')) if election.owner.id == current_user.id: statuses = Status.query.all()
No need for the second render_template I think
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bubbl-oss/evoting/pull/48#pullrequestreview-607876529, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRZIWJV3NCOYOEJHQYWPYTTCZ447ANCNFSM4Y3ZYHZQ .
There is a need for the second one The first one only happens when the it's the owner accessing the route so it has statuses while the other is is for when other people access the route hence the lack of statuses
On Tue, 9 Mar 2021, 21:00 Emmanuel Segun-Lean, notifications@github.com wrote: