fixed some bugs with the get-all-shared for new users
parent
0339653954
commit
af84024889
5
auth.py
5
auth.py
|
@ -38,9 +38,10 @@ def register():
|
||||||
dbsession.commit()
|
dbsession.commit()
|
||||||
|
|
||||||
#Preden zapremo naj user dobi vse shared karte od prej.
|
#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()
|
dbsession.close()
|
||||||
|
|
||||||
|
|
5
share.py
5
share.py
|
@ -35,8 +35,9 @@ def get_all_shared(user_id):
|
||||||
dbsession = get_session()
|
dbsession = get_session()
|
||||||
|
|
||||||
#get all cards with a shared id but make suer they are unique. add them to collection of user
|
#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)
|
#@TODO A je to resres ok?
|
||||||
# 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)
|
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:
|
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)
|
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)
|
dbsession.add(new_card)
|
||||||
|
|
Loading…
Reference in New Issue