From 6dbf73d57a550e3d3d1bfa819e69e374c6af29d3 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 27 Feb 2024 15:33:02 +0200 Subject: [PATCH] fix publishers api --- .gitignore | 2 ++ .vscode/settings.json | 3 +-- pages/api/index.ts | 4 ++-- pages/cart/publishers/index.tsx | 5 ++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 670be0a..5eb21a0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ next-cart-app.zip certificates content/output/* baseUrl.txt +content/publisherShiftStats.json +content/publisherShiftStats.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 702175c..7c49be6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,8 +5,7 @@ "html.format.wrapAttributes": "force", "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll": true, - // "source.organizeImports": true + "source.fixAll": "explicit" }, "[dotenv]": { "editor.defaultFormatter": "foxundermoon.shell-format" diff --git a/pages/api/index.ts b/pages/api/index.ts index bb8b2a9..fb4cbe7 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -312,8 +312,8 @@ export async function filterPublishers(selectFields, searchText, filterDate, fet id: String(id) } } - const searchTextString = String(searchText).trim(); - if (searchTextString) { + const searchTextString = String(searchText || "").trim(); + if (searchTextString !== "") { whereClause = { OR: [ { firstName: { contains: searchTextString } }, diff --git a/pages/cart/publishers/index.tsx b/pages/cart/publishers/index.tsx index cf32d0c..8bc1055 100644 --- a/pages/cart/publishers/index.tsx +++ b/pages/cart/publishers/index.tsx @@ -68,8 +68,7 @@ function PublishersPage({ publishers = [] }: IProps) { } else { similarity = 1 - (distance - lenDiff) / distance; } - - console.log("distance: " + distance + "; lenDiff: " + lenDiff + " similarity: " + similarity + "; " + fullName + " =? " + filter + "") + //console.log("distance: " + distance + "; lenDiff: " + lenDiff + " similarity: " + similarity + "; " + fullName + " =? " + filter + "") return similarity >= 0.95; }); @@ -191,7 +190,7 @@ function PublishersPage({ publishers = [] }: IProps) { {renderPublishers()} - + ); }