From f47b7b61749e519d694cff841b4e961fd211c0dd Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 29 Jan 2025 10:06:38 -0500
Subject: fixed chat based sorting and tagging of docs

---
 src/client/views/collections/CollectionCardDeckView.tsx | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'src/client/views/collections/CollectionCardDeckView.tsx')

diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index aaf33c3a1..366d0f448 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -27,7 +27,7 @@ import { DocumentView, DocumentViewProps } from '../nodes/DocumentView';
 import { FocusViewOptions } from '../nodes/FocusViewOptions';
 import { GPTPopup } from '../pdf/GPTPopup/GPTPopup';
 import './CollectionCardDeckView.scss';
-import { CollectionSubView, SubCollectionViewProps } from './CollectionSubView';
+import { CollectionSubView, docSortings, SubCollectionViewProps } from './CollectionSubView';
 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
 import { SettingsManager } from '../../util/SettingsManager';
 
@@ -243,7 +243,7 @@ export class CollectionCardView extends CollectionSubView() {
                     const sorted = this.childDocs;
                     const originalIndex = sorted.findIndex(doc => doc === draggedDoc);
 
-                    this.Document.card_sort = '';
+                    this.Document[this._props.fieldKey + '_sort'] = '';
                     originalIndex !== -1 && sorted.splice(originalIndex, 1);
                     sorted.splice(dragIndex, 0, draggedDoc);
                     if (de.complete.docDragData.removeDocument?.(draggedDoc)) {
@@ -450,7 +450,7 @@ export class CollectionCardView extends CollectionSubView() {
         }
 
         if (questionType === '6') {
-            this.Document.card_sort = 'chat';
+            this.Document[this._props.fieldKey + '_sort'] = docSortings.Chat;
         }
 
         listItems.forEach((item, index) => {
@@ -467,16 +467,15 @@ export class CollectionCardView extends CollectionSubView() {
                         let myTag = '';
                         if (tag) {
                             for (let i = 0; i < allHotKeys.length; i++) {
-                                // bcz: CHECK THIS CODE OUT -- SOMETHING CHANGED
                                 const keyTag = StrCast(allHotKeys[i].toolType);
-                                if (tag.includes(keyTag)) {
+                                if (keyTag.includes(tag)) {
                                     myTag = keyTag;
                                     break;
                                 }
                             }
 
                             if (myTag) {
-                                doc[myTag] = true;
+                                TagItem.addTagToDoc(doc, myTag);
                             }
                         }
                         break;
-- 
cgit v1.2.3-70-g09d2

