Ver Fonte

bug fix: listed art not showing up at profile page

control há 3 anos atrás
pai
commit
51f1cd5088
3 ficheiros alterados com 5 adições e 10 exclusões
  1. 1 1
      app/dashboards.py
  2. BIN
      app/database.db
  3. 4 9
      app/lib/collector.py

+ 1 - 1
app/dashboards.py

@@ -40,7 +40,7 @@ def profile():
             u_dbcall.focus = focus_item
             db.session.commit()
             return redirect(url_for('dashboards.detail'))
-        elif focus_item and not collector.check_art_listing(focus_item):
+        elif focus_item and collector.check_art_listing(focus_item):
             pass
 
 

BIN
app/database.db


+ 4 - 9
app/lib/collector.py

@@ -56,15 +56,10 @@ def check_art_listing(filehash):
     # if not, block redirection to detailed page.
     owned_art = Art.query.filter_by(owner = current_user.id).all() 
     listed_art = List.query.filter_by(seller = current_user.id).all()
-    for oa in owned_art:
-        for la in listed_art:
-            if oa.filehash == la.filehash:
-                return True
-            else:
-                return False
-        if not listed_art:
-            return False
-
+    for la in listed_art:
+        if filehash == la.filehash:
+            return True
+    return False
 
 def find_user_obj(user_id):
     user = User.query.filter_by(id = user_id).first()