Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #41

Merged
merged 52 commits into from
Apr 20, 2019
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
7d98e57
editable userrole by ferdinand and invitation&application logic
OleKet Jun 12, 2018
0a7b408
removing db from app
3j14 Jun 13, 2018
a244503
Merge branch 'master' of github.com:Info-ag/labplaner into dev
3j14 Jun 14, 2018
210d285
cleanup
3j14 Jun 14, 2018
4d1ade2
adding success
3j14 Jun 14, 2018
07c2523
adding remember me
3j14 Jun 14, 2018
e21b7c2
remember me button
OleKet Jun 14, 2018
9c1c320
completed test
3j14 Jun 14, 2018
6b334c3
adding email confirmation
3j14 Jun 14, 2018
6d6c35a
message Feature for AGs & with email when email is confirmed
OleKet Jun 15, 2018
2677f7e
removed useless prints. replaced double quotes with single quotes
OleKet Jun 15, 2018
4a816b5
pylint comments, module doc string, splitting ag_api and utils
OleKet Jun 15, 2018
6009106
adding docstrings and comments
OleKet Jun 16, 2018
400d658
changing docstrings
3j14 Jun 24, 2018
4e0123a
Adding huey starter
3j14 Feb 1, 2019
b8db869
Set up run for future use
3j14 Feb 1, 2019
4b7a811
rename utils to util
3j14 Feb 1, 2019
c16a06c
add huey tasks
3j14 Feb 1, 2019
45ee1ad
Removing unnecessary junk
3j14 Apr 6, 2019
db893f3
delete unused files
3j14 Apr 11, 2019
a122aa4
add config
3j14 Apr 11, 2019
ccf85e8
add tests
3j14 Apr 11, 2019
2c83c1e
add manage script
3j14 Apr 11, 2019
4d2fe75
rename file
3j14 Apr 11, 2019
cacb5d4
add i18n
3j14 Apr 11, 2019
a7b5cf2
move messages to extra file
3j14 Apr 11, 2019
b3e4acb
remove unnecessary files
3j14 Apr 11, 2019
b16d438
add function to create app and db
3j14 Apr 11, 2019
d7f5083
fix permissions
3j14 Apr 11, 2019
a91f7fc
add os to gitignore
3j14 Apr 11, 2019
f714814
add new dependencies
3j14 Apr 11, 2019
168b98e
add versions
3j14 Apr 11, 2019
912ca09
rename utils -> util
3j14 Apr 11, 2019
2f8b18b
pep8 stuff
3j14 Apr 11, 2019
acefac9
fix event model
3j14 Apr 11, 2019
31d54ec
clean up comments
3j14 Apr 11, 2019
4903dbd
fix date model
3j14 Apr 11, 2019
ef0562d
fix ag model
3j14 Apr 11, 2019
6766d90
update readme
3j14 Apr 11, 2019
a20bfd0
add new test routines
3j14 Apr 11, 2019
a87b9f2
use assertEqual instead of keyword
3j14 Apr 11, 2019
e9d2e6f
add style guide
3j14 Apr 11, 2019
5689995
rewrite comment
3j14 Apr 11, 2019
d4d9003
add redis session
3j14 Apr 11, 2019
49c3642
fix comment
3j14 Apr 11, 2019
2fdc7b5
. instead of :
3j14 Apr 11, 2019
d63918e
add babel
3j14 Apr 11, 2019
e777fe5
add session
3j14 Apr 11, 2019
9325fa2
fix redis session
3j14 Apr 11, 2019
3ed6f01
fix comments
3j14 Apr 11, 2019
5485f51
who needs pizza
3j14 Apr 11, 2019
af0aa34
fix lines
3j14 Apr 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix date model
  • Loading branch information
3j14 committed Apr 11, 2019
commit 4903dbd76623bc2dd520a218306ff29ca731715e
36 changes: 18 additions & 18 deletions app/models/date.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
'''
"""
All Database models regarding Dates
---> Date
All Marshmallow Schemas regarding those models
--> DateSchema
'''
from app import ma
"""
from app.models import db


class Date(db.Model):
"""Date table

If a specific date is needed, it will be created in this table. A
date is related to users (that specified their availability on that
date) and to events (that offer this date). This way, each date will
only occure once and it is easy to get an overview of all available
users that signed up for that day.

Relationships:
- `dates_users`
- `dates_events`
"""
__tablename__ = 'dates'

id = db.Column(db.Integer, primary_key=True, unique=True, nullable=False)
day = db.Column(db.Date, nullable=False, unique=True)

users = db.relationship('User', secondary='users_dates')
events = db.relationship('Event', secondary='events_dates')
users = db.relationship('User', secondary='dates_users')
events = db.relationship('Event', secondary='dates_events')


class DateSchema(ma.Schema):
count = ma.Method('count_users')

def count_users(self, obj: Date):
event_id = self.context.get('event_id')
users = []
for user in obj.users: # that
for ag in user.ags: # shit
for event in ag.events: # is
if event.id == event_id: # damn
users.append(user) # nested

return len(users)

class Meta:
fields = ('id', 'day', 'count')
fields = ('id', 'day')