Skip to content

Commit

Permalink
fix issue #4 and constraint non-null for workshop fields
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyphantom committed Jan 25, 2019
1 parent 368fd80 commit ab63bb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions app/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def global_total_stats():
# 'studenthours': sum(df['workshop_hours'] * df['class_size']),
'companies': sum(df['workshop_category'] == 'Corporate'),
'instructors': len(df['workshop_instructor'].unique()),
'topten': g.df2.loc[:,['name','workshop_hours', 'class_size']].groupby(
'topten': g.df2[g.df2.name != 'Capstone'].loc[:,['name','workshop_hours', 'class_size']].groupby(
'name').sum().sort_values(
by='workshop_hours',
ascending=False).head(10).rename_axis(None).to_html(classes=['table thead-light table-striped table-bordered table-hover table-sm'])
Expand Down Expand Up @@ -371,8 +371,7 @@ def person_total_stats():
'fullstar': fullstar,
'responsecount': len(responses),
'qualitative': qualitative,
# change here:
'topten': g.df2.loc[:,['name','workshop_hours', 'class_size']].groupby(
'topten': g.df2[g.df2.name != 'Capstone'].loc[:,['name','workshop_hours', 'class_size']].groupby(
'name').sum().sort_values(
by='workshop_hours',
ascending=False).head(10).rename_axis(None).to_html(classes=['table thead-light table-striped table-bordered table-hover table-sm'])
Expand Down
8 changes: 4 additions & 4 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class Workshop(db.Model):
name="workshop_category"), nullable=False)
workshop_instructor = db.Column(db.Integer, db.ForeignKey(
'employee.id'), nullable=False)
workshop_start = db.Column(db.DateTime, default=datetime.utcnow)
workshop_hours = db.Column(db.Integer)
workshop_venue = db.Column(db.String(64))
class_size = db.Column(db.Integer)
workshop_start = db.Column(db.DateTime, default=datetime.utcnow, nullable=False)
workshop_hours = db.Column(db.Integer, nullable=False)
workshop_venue = db.Column(db.String(64), nullable=False)
class_size = db.Column(db.Integer, nullable=False)
responses = db.relationship('Response', backref='workshop', lazy='dynamic')

def __repr__(self):
Expand Down

0 comments on commit ab63bb7

Please sign in to comment.