Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
|
@@ -301,8 +301,9 @@ async def face_swap_api(
|
|
| 301 |
target_url = asset["url"]
|
| 302 |
|
| 303 |
# correct categoryId (ObjectId)
|
| 304 |
-
category_oid = doc["categoryId"] # <-- DO NOT CONVERT TO STRING
|
| 305 |
-
|
|
|
|
| 306 |
# ------------------------------------------------------------------
|
| 307 |
# MEDIA_CLICKS (ONLY IF user_id PRESENT)
|
| 308 |
# ------------------------------------------------------------------
|
|
@@ -312,7 +313,8 @@ async def face_swap_api(
|
|
| 312 |
now = datetime.utcnow()
|
| 313 |
|
| 314 |
update_result = await media_clicks_col.update_one(
|
| 315 |
-
{"userId": user_oid, "categories.categoryId": category_oid},
|
|
|
|
| 316 |
{
|
| 317 |
"$set": {
|
| 318 |
"updatedAt": now,
|
|
@@ -331,7 +333,8 @@ async def face_swap_api(
|
|
| 331 |
"$set": {"updatedAt": now},
|
| 332 |
"$push": {
|
| 333 |
"categories": {
|
| 334 |
-
"categoryId": category_oid,
|
|
|
|
| 335 |
"click_count": 1,
|
| 336 |
"lastClickedAt": now
|
| 337 |
}
|
|
|
|
| 301 |
target_url = asset["url"]
|
| 302 |
|
| 303 |
# correct categoryId (ObjectId)
|
| 304 |
+
#category_oid = doc["categoryId"] # <-- DO NOT CONVERT TO STRING
|
| 305 |
+
subcategory_oid = doc["_id"]
|
| 306 |
+
|
| 307 |
# ------------------------------------------------------------------
|
| 308 |
# MEDIA_CLICKS (ONLY IF user_id PRESENT)
|
| 309 |
# ------------------------------------------------------------------
|
|
|
|
| 313 |
now = datetime.utcnow()
|
| 314 |
|
| 315 |
update_result = await media_clicks_col.update_one(
|
| 316 |
+
#{"userId": user_oid, "categories.categoryId": category_oid},
|
| 317 |
+
{"userId": user_oid, "categories.categoryId": subcategory_oid},
|
| 318 |
{
|
| 319 |
"$set": {
|
| 320 |
"updatedAt": now,
|
|
|
|
| 333 |
"$set": {"updatedAt": now},
|
| 334 |
"$push": {
|
| 335 |
"categories": {
|
| 336 |
+
#"categoryId": category_oid,
|
| 337 |
+
"categoryId": subcategory_oid,,
|
| 338 |
"click_count": 1,
|
| 339 |
"lastClickedAt": now
|
| 340 |
}
|