Skip to content
Snippets Groups Projects
Commit e585f6d1 authored by Hinrikus Wolf's avatar Hinrikus Wolf
Browse files

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

parent cc3ef4e9
No related branches found
No related tags found
No related merge requests found
...@@ -143,10 +143,13 @@ class Speaker(db.Model): ...@@ -143,10 +143,13 @@ class Speaker(db.Model):
return "{} ({})".format(self.name, self.number) return "{} ({})".format(self.name, self.number)
def count(self, topic): 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): 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): class Statement(db.Model):
......
...@@ -277,16 +277,11 @@ def statement_new(): ...@@ -277,16 +277,11 @@ def statement_new():
form = AddStatementForm() form = AddStatementForm()
if form.validate_on_submit(): if form.validate_on_submit():
statement = request.form.get("submit","add_statement") statement = request.form.get("submit","add_statement")
if statement == "add_meta_statement":
topic = Topic.query.filter_by(id=form.topic.data).first()
return redirect(url_for(".topic_show", id=topic.id))
else:
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) speaker = speaker_by_name_or_number(form.speaker_name.data, topic.event.id)
if topic is not None and speaker is not None: if topic is not None and speaker is not None:
if speaker.count_active(topic) == 0: if speaker.count_active(topic) == 0 or (statement == "add_meta_statement" and speaker.count_active_meta(topic) == 0) :
statement = Statement(speaker.id, topic.id) statement = Statement(speaker.id, topic.id, is_meta=(statement == "add_meta_statement"))
db.session.add(statement) db.session.add(statement)
db.session.commit() db.session.commit()
return redirect(url_for(".topic_show", id=topic.id)) return redirect(url_for(".topic_show", id=topic.id))
......
...@@ -131,3 +131,10 @@ th.rede-medium-text { ...@@ -131,3 +131,10 @@ th.rede-medium-text {
.rede-list-point-normal { .rede-list-point-normal {
font-weight: normal; font-weight: normal;
} }
.rede-table-bg-red {
color: white;
background-color: #F44335;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment