Skip to content

Commit

Permalink
working on query to filter user recommended events
Browse files Browse the repository at this point in the history
  • Loading branch information
marksilvis committed Oct 30, 2017
1 parent 1d65a05 commit 2f77fd1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pittgrub/db/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def verification(self, verification_code: str) -> bool:
if verification and verification.code is verification_code:
self.active = True
UserVerification.delete(verification_code)
db.session.commit()

def add_expo_token(self, expo_token: str):
self.expo_token = expo_token
Expand Down Expand Up @@ -541,6 +542,10 @@ def add(cls, user_id: int, event_id: int) -> 'UserRecommendedEvent':
db.session.refresh(user_recommended_event)
return user_recommended_event

@classmethod
def user_active_recommendations(cls, user_id: int) -> List['UserRecommendedEvent']:
entities = db.session.query(cls).filter(cls.event.end_date > datetime.datetime.utcnow())
return entities

def json(cls, deep: bool=False) -> Dict[str, Any]:
if deep:
Expand Down

0 comments on commit 2f77fd1

Please sign in to comment.