proper handling of feedback types

This commit is contained in:
Dobromir Popov
2024-04-17 14:07:39 +03:00
parent 2c45064391
commit c161a5f0ca
2 changed files with 25 additions and 9 deletions

View File

@ -55,7 +55,7 @@ export default function FeedbackForm({ publisherId, onDone }) {
assignmentId: 0,
publisherId: publisherId,
date: new Date(),
placementCount: 0,
placementCount: 1,
videoCount: 0,
returnVisitInfoCount: 0,
conversationCount: 0
@ -72,9 +72,9 @@ export default function FeedbackForm({ publisherId, onDone }) {
const handleSubmit = async (e) => {
e.preventDefault();
item.
item.publisher = { connect: { id: pubId } };
item.type = ReportType.Feedback;
item.publisher = { connect: { id: pubId } };
//ToDo: create dedicated feedback type instead of using placementCount for subtype
item.type = item.placementCount === 1 ? ReportType.Feedback_Problem : (item.placementCount === 2 ? ReportType.Feedback_Suggestion : ReportType.Feedback);
delete item.assignmentId;
try {