diff --git a/create_db.py b/create_db.py index ddb6eb3..53aff5f 100644 --- a/create_db.py +++ b/create_db.py @@ -36,7 +36,7 @@ class Card(Base): interest_rate = Column(Float) item_location = Column(String(1024)) last_review = Column(Text) - #shared = Column(BOOLEAN) #tu bo že problem, ker mora imeti shared za vsakega svoj IR + share_id = Column(Integer) #explain: 0 means not shared, otherwise increment from db and generate new cards for all relevant(tbd) users class Deck(Base): __tablename__ = 'deck' diff --git a/populate_db_once.py b/populate_db_once.py index b5c171a..71d7092 100644 --- a/populate_db_once.py +++ b/populate_db_once.py @@ -27,7 +27,7 @@ for item in l: public_share = nc.share_file_with_link("/GIA CLOUD/"+name) public_link = public_share.get_link()+"/download/"+name - card = Card(title=name, interest_rate=-1.0, owner_id=1, item_location=public_link, last_review=None) + card = Card(title=name, interest_rate=-1.0, owner_id=1, item_location=public_link, last_review=None, share_id=0) dbsession.add(card) dbsession.commit() diff --git a/upload.py b/upload.py index f358677..d66e195 100644 --- a/upload.py +++ b/upload.py @@ -57,7 +57,7 @@ def upload_file(): public_link = nc.share_file_with_link("/GIA CLOUD/" + filename).get_link()+"/download/"+filename #add card - card = Card(title=filename, interest_rate=-1.0, owner_id=user_id, item_location=public_link, last_review=None) + card = Card(title=filename, interest_rate=-1.0, owner_id=user_id, item_location=public_link, last_review=None, share_id=0) dbsession.add(card) dbsession.commit()