Commit e585f6d1 authored by Hinrikus Wolf's avatar Hinrikus Wolf

make meta working propery -- color on hover could be better

parent cc3ef4e9
......@@ -143,11 +143,14 @@ class Speaker(db.Model):
return "{} ({})".format(self.name, self.number)
def count(self, topic):
return len([statement for statement in self.statements if statement.topic == topic])
return len([statement for statement in self.statements if statement.topic == topic and not statement.is_meta])
def count_active(self, topic):
return len([statement for statement in self.statements if statement.topic == topic and not statement.executed])
return len([statement for statement in self.statements if statement.topic == topic and not statement.executed and not statement.is_meta])
def count_active_meta(self, topic):
return len([statement for statement in self.statements if statement.topic == topic and not statement.executed and statement.is_meta])
class Statement(db.Model):
__tablename__ = "statements"
......
......@@ -277,19 +277,14 @@ def statement_new():
form = AddStatementForm()
if form.validate_on_submit():
statement = request.form.get("submit","add_statement")
if statement == "add_meta_statement":
topic = Topic.query.filter_by(id=form.topic.data).first()
topic = Topic.query.filter_by(id=form.topic.data).first()
speaker = speaker_by_name_or_number(form.speaker_name.data, topic.event.id)
if topic is not None and speaker is not None:
if speaker.count_active(topic) == 0 or (statement == "add_meta_statement" and speaker.count_active_meta(topic) == 0) :
statement = Statement(speaker.id, topic.id, is_meta=(statement == "add_meta_statement"))
db.session.add(statement)
db.session.commit()
return redirect(url_for(".topic_show", id=topic.id))
else:
topic = Topic.query.filter_by(id=form.topic.data).first()
speaker = speaker_by_name_or_number(form.speaker_name.data, topic.event.id)
if topic is not None and speaker is not None:
if speaker.count_active(topic) == 0:
statement = Statement(speaker.id, topic.id)
db.session.add(statement)
db.session.commit()
return redirect(url_for(".topic_show", id=topic.id))
return render_layout("admin_statement_new.html", form=form)
@admin.route("/statement/done")
......
......@@ -131,3 +131,10 @@ th.rede-medium-text {
.rede-list-point-normal {
font-weight: normal;
}
.rede-table-bg-red {
color: white;
background-color: #F44335;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment