Browse Source

fixed some bugs with the get-all-shared for new users

master
Kostanjevec 4 weeks ago
parent
commit
af84024889
  1. 5
      auth.py
  2. 5
      share.py

5
auth.py

@ -38,9 +38,10 @@ def register():
dbsession.commit()
#Preden zapremo naj user dobi vse shared karte od prej.
user_id = None #TODO get user id
new_user = dbsession.query(User).filter(User.username == username).first()
new_user_id = new_user.id
get_all_shared(user_id)
get_all_shared(new_user_id)
dbsession.close()

5
share.py

@ -35,8 +35,9 @@ def get_all_shared(user_id):
dbsession = get_session()
#get all cards with a shared id but make suer they are unique. add them to collection of user
all_shared_cards = dbsession.query(Card).filter(Card.share_id != 0).distinct(Card.share_id).group_by(Card.share_id)
# new_card = card = Card(title=card.title, interest_rate=-1.0, owner_id=user.id, item_location=card.item_location, last_review=None, share_id=h)
#@TODO A je to resres ok?
all_shared_cards = dbsession.query(Card).filter(Card.share_id != "0").distinct(Card.share_id).group_by(Card.share_id)
for c in all_shared_cards:
new_card = Card(title= c.title, interest_rate=-1.0, owner_id=user_id, item_location=c.item_location, last_review=None, share_id=c.share_id)
dbsession.add(new_card)

Loading…
Cancel
Save