任务看板搜索功能报错BUG修复,已删除任务不在审核
This commit is contained in:
parent
86a1a33693
commit
ee0f7d0a68
@ -1039,6 +1039,11 @@ def _ask_assignment_data(
|
|||||||
"product_name": assignment.task.product_name,
|
"product_name": assignment.task.product_name,
|
||||||
"product_link": assignment.task.product_link,
|
"product_link": assignment.task.product_link,
|
||||||
"product_qr": _product_qr_data(assignment.task),
|
"product_qr": _product_qr_data(assignment.task),
|
||||||
|
"creator_name": (
|
||||||
|
assignment.task.owner.display_name
|
||||||
|
if assignment.task.owner
|
||||||
|
else "运营后台"
|
||||||
|
),
|
||||||
"user_id": _public_user_id(assignment.user),
|
"user_id": _public_user_id(assignment.user),
|
||||||
"taobao_id": assignment.user.taobao_id,
|
"taobao_id": assignment.user.taobao_id,
|
||||||
"phone": _public_user_account(assignment.user),
|
"phone": _public_user_account(assignment.user),
|
||||||
@ -2915,7 +2920,9 @@ def admin_task_board(
|
|||||||
answer_filter = or_(
|
answer_filter = or_(
|
||||||
AnswerSubmission.submission_no.like(pattern),
|
AnswerSubmission.submission_no.like(pattern),
|
||||||
AnswerSubmission.shop_name.like(pattern),
|
AnswerSubmission.shop_name.like(pattern),
|
||||||
AnswerSubmission.product_name.like(pattern),
|
AnswerSubmission.questions.any(
|
||||||
|
AnswerRecognizedQuestion.product_title.like(pattern)
|
||||||
|
),
|
||||||
AnswerSubmission.user.has(or_(
|
AnswerSubmission.user.has(or_(
|
||||||
AnswerUser.taobao_id.like(pattern),
|
AnswerUser.taobao_id.like(pattern),
|
||||||
AnswerUser.public_id.like(pattern),
|
AnswerUser.public_id.like(pattern),
|
||||||
|
|||||||
@ -413,6 +413,9 @@ def test_ask_review_detail_loads_screenshots_from_protected_endpoint():
|
|||||||
)
|
)
|
||||||
db.add_all([public_user, task])
|
db.add_all([public_user, task])
|
||||||
db.flush()
|
db.flush()
|
||||||
|
task_id = task.id
|
||||||
|
task_no = task.task_no
|
||||||
|
creator_name = owner.display_name
|
||||||
question = main_module.AskQuestion(
|
question = main_module.AskQuestion(
|
||||||
task_id=task.id,
|
task_id=task.id,
|
||||||
sequence_no=1,
|
sequence_no=1,
|
||||||
@ -456,17 +459,25 @@ def test_ask_review_detail_loads_screenshots_from_protected_endpoint():
|
|||||||
])
|
])
|
||||||
db.commit()
|
db.commit()
|
||||||
batch_id = batch.id
|
batch_id = batch.id
|
||||||
|
assignment_id = assignment.id
|
||||||
|
|
||||||
detail = client.get(f"/api/admin/ask-batch-reviews/{batch_id}")
|
detail = client.get(f"/api/admin/ask-batch-reviews/{batch_id}")
|
||||||
assert detail.status_code == 200
|
assert detail.status_code == 200
|
||||||
data = detail.json()["data"]
|
data = detail.json()["data"]
|
||||||
assert "base64" not in detail.text
|
assert "base64" not in detail.text
|
||||||
|
assert data["creator_name"] == creator_name
|
||||||
question_url = data["question_screenshots"][0]["data_url"]
|
question_url = data["question_screenshots"][0]["data_url"]
|
||||||
payment_url = data["payment_screenshots"][0]["data_url"]
|
payment_url = data["payment_screenshots"][0]["data_url"]
|
||||||
assert question_url.startswith("/api/admin/ask-batch-screenshots/")
|
assert question_url.startswith("/api/admin/ask-batch-screenshots/")
|
||||||
assert client.get(question_url).content == b"ask-question-image"
|
assert client.get(question_url).content == b"ask-question-image"
|
||||||
assert client.get(payment_url).content == b"ask-payment-image"
|
assert client.get(payment_url).content == b"ask-payment-image"
|
||||||
|
|
||||||
|
search = client.get("/api/admin/task-board", params={"keyword": task_no})
|
||||||
|
assert search.status_code == 200
|
||||||
|
assert search.json()["data"]["total"] == 1
|
||||||
|
assert search.json()["data"]["items"][0]["task_id"] == task_no
|
||||||
|
assert search.json()["data"]["items"][0]["creator_name"] == creator_name
|
||||||
|
|
||||||
decision = client.post(
|
decision = client.post(
|
||||||
f"/api/admin/ask-batch-reviews/{batch_id}/decision",
|
f"/api/admin/ask-batch-reviews/{batch_id}/decision",
|
||||||
json={"approved": True},
|
json={"approved": True},
|
||||||
@ -475,6 +486,13 @@ def test_ask_review_detail_loads_screenshots_from_protected_endpoint():
|
|||||||
assert "base64" not in decision.text
|
assert "base64" not in decision.text
|
||||||
assert decision.json()["data"]["latest_review"]["approved"] is True
|
assert decision.json()["data"]["latest_review"]["approved"] is True
|
||||||
|
|
||||||
|
deleted = client.delete(f"/api/admin/task-board/ask-tasks/{task_id}")
|
||||||
|
assert deleted.status_code == 200
|
||||||
|
with main_module.SessionLocal() as db:
|
||||||
|
assert db.get(main_module.AskTask, task_id) is None
|
||||||
|
assert db.get(main_module.AskAssignment, assignment_id) is None
|
||||||
|
assert db.get(main_module.AskAssignmentBatch, batch_id) is None
|
||||||
|
|
||||||
|
|
||||||
def test_failed_answer_recognition_has_no_fake_questions_and_can_retry(monkeypatch):
|
def test_failed_answer_recognition_has_no_fake_questions_and_can_retry(monkeypatch):
|
||||||
unique = uuid4().hex[:10]
|
unique = uuid4().hex[:10]
|
||||||
|
|||||||
@ -284,6 +284,7 @@ function AskReviewDetail({ record, close, api, onDecision, hasNext, onNext, next
|
|||||||
<code>{record.user_id}</code>
|
<code>{record.user_id}</code>
|
||||||
<code>{record.task_id}</code>
|
<code>{record.task_id}</code>
|
||||||
<span>商品:{record.product_name}</span>
|
<span>商品:{record.product_name}</span>
|
||||||
|
<span>创建人:{record.creator_name || "运营后台"}</span>
|
||||||
<span>提交时间:{formatTime(record.updated_at)}</span>
|
<span>提交时间:{formatTime(record.updated_at)}</span>
|
||||||
</div>
|
</div>
|
||||||
<h3>① 用户认领并完成的提问</h3>
|
<h3>① 用户认领并完成的提问</h3>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user