UCF / Search-Service-Django

A django based REST API for accessing search data and related data management tools.
0 stars 0 forks source link

pulling highlight Json in views.py #428

Closed Ramin-Farhadi closed 4 months ago

Ramin-Farhadi commented 4 months ago

We are pulling the JSON highlights in a hidden field by views.py

jmbarne3 commented 4 months ago

Does it matter what order the highlights appear in? If so, how are we keeping track of the order?

Ramin-Farhadi commented 4 months ago

Does it matter what order the highlights appear in? If so, how are we keeping track of the order?

I don't think order is important but It's an array of objects, so each object has own index.

jmbarne3 commented 4 months ago

I can guarantee you the people using the tool are going to care what order the highlights appear in. They're going to want them to appear in the same order on the page as they appear in our tool. We can either embed the index in the ID, i.e. id-highlight-{index} or we can put the information elsewhere, like a data attribute, i.e. data-order={index}. Either way will work fine.

Ramin-Farhadi commented 4 months ago

I can guarantee you the people using the tool are going to care what order the highlights appear in. They're going to want them to appear in the same order on the page as they appear in our tool. We can either embed the index in the ID, i.e. id-highlight-{index} or we can put the information elsewhere, like a data attribute, i.e. data-order={index}. Either way will work fine.

Ok I will work on that.

jmbarne3 commented 4 months ago

I get the following output:

[{"id":"id-1720800644207","data_order":2,"iconClass":"fa-face-smile fa m-2","description":"This is a smiley face."},{"id":"id-1720800655327","data_order":2,"iconClass":"fa-arrow-up fa m-2","description":"This is an up arrow."}]

When I take the following steps:

  1. Add an icon and description.
  2. Add another icon and description.
  3. Add a third icon and description.
  4. Delete the first icon and description.
  5. Save.
Ramin-Farhadi commented 4 months ago

I get the following output:

[{"id":"id-1720800644207","data_order":2,"iconClass":"fa-face-smile fa m-2","description":"This is a smiley face."},{"id":"id-1720800655327","data_order":2,"iconClass":"fa-arrow-up fa m-2","description":"This is an up arrow."}]

When I take the following steps:

  1. Add an icon and description.
  2. Add another icon and description.
  3. Add a third icon and description.
  4. Delete the first icon and description.
  5. Save.

Logic added, It will be updated when we remove a story.