Эх сурвалжийг харах

bug fix: backend for owned art and created art fixed

control 3 жил өмнө
parent
commit
6941e487ae

BIN
app/database.db


+ 5 - 1
app/dispatch.py

@@ -75,7 +75,7 @@ def list_item(designated_fn, art_name, art_desc, min_price, buyout_price, close_
     # gen txhash
     ddt = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")
     dt = sqlalchemy.func.now()
-    txstring = f'[{filehash}, {ddt}, {current_user.id}, {current_user.id}, 0.0]' # minting
+    txstring = f'[{filehash}, {ddt}, {current_user.id}, {current_user.id}, 0.0]' # listing
     txhash = hsh.gen_txhash(txstring)
     # fetch prev block hash OR GEN HASH
     try:
@@ -147,6 +147,10 @@ def tx_exchange(filehash, source_id, price, dest_id=None):
     # remove from List table
     List.query.filter_by(filehash = filehash).delete()
 
+    # change owner at Art table
+    dbcall = Art.query.filter_by(filehash = filehash).first()
+    dbcall.owner = dest_id
+
     db.session.commit()
 
 def clean_bid_table(filehash):

+ 2 - 2
app/lib/collector.py

@@ -44,10 +44,10 @@ def check_listing():
     # to remove art that is already listed
     for art in owned_art:
         if not listed_art:
-            available_art.append(oa)
+            available_art.append(art)
         # if none of the list of objects' filehash matches this filehash
         if not any(la.filehash == art.filehash for la in listed_art):
-            available_art.append(oa)
+            available_art.append(art)
 
 
     return available_art

+ 0 - 0
app/static/repository/jQ0pHk4RfCc8e7MC.jpeg → app/static/repository/xtsQGBoMv1PW9bqr.jpeg


+ 2 - 2
app/templates/profile.html

@@ -100,7 +100,7 @@
                         <div class="tab-content" id="myTabContent">
                             <div class="tab-pane fade show active" id="art_by_me" role="tabpanel" aria-labelledby="art_by_me-tab">   
                                 <div class="row row-cols-3">
-                                {%for art in my_art%}
+                                {%for art in my_creation%}
                                     <div class="card col-md-4 shadow p-3 mb-5 bg-white rounded"  type="button">
                                         <form method="POST">
                                             <!--<a href="detail"></a>-->
@@ -115,7 +115,7 @@
                             </div>
                             <div class="tab-pane fade" id="art_by_own" role="tabpanel" aria-labelledby="art_by_own-tab">.
                                 <div class="row row-cols-3">
-                                    {%for art in my_creation%}
+                                    {%for art in my_art%}
                                     <div class="card col-md-4 shadow p-3 mb-5 bg-white rounded"  type="button">
                                         <form method="POST">
                                             <!--<a href="detail"></a>-->