Skip to content

Commit 0101537

Browse files
authored
Merge branch 'dev' into 1252-document-type-filter-not-working-in-delta-urls-page
2 parents fce770a + 2739ad4 commit 0101537

File tree

6 files changed

+38
-20
lines changed

6 files changed

+38
-20
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,9 @@ For each PR made, an entry should be added to this changelog. It should contain
142142
- Description: Fixed document type filtering functionality in the "Document Type Patterns" tab in Delta URLs page.
143143
- Changes:
144144
- Added a new event listener to the Document Type Patterns dropdown to trigger the filtering of the table results based on the selected value.
145+
146+
- 1251-column-sorting-issue-curated-urls-count-sorts-by-delta-urls-count
147+
- Description: Fixed incorrect sorting behavior in Collections table where sorting by Curated URLs column was not working as expected.
148+
- Changes:
149+
- Added `data-order` attribute to URL count columns for proper numeric sorting
150+
- Updated SearchPane comparisons to use `@data-order` values instead of string-based loose equality checks to ensure correct numeric filtering

config/settings/base.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@
102102
"http://sciencediscoveryengine.nasa.gov",
103103
"https://localhost:4200",
104104
"http://localhost:4200",
105-
"https://sde-lrm.nasa-impact.net/app/nasa-sba-tdamm/",
106-
"https://sde-lrm.nasa-impact.net/app/nasa-sba-smd/",
107-
"http://sde-lrm.nasa-impact.net/app/nasa-sba-tdamm/",
108-
"http://sde-lrm.nasa-impact.net/app/nasa-sba-smd/",
109105
]
110106

111107
# MIGRATIONS

config/settings/local.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252

5353
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#task-eager-propagates
5454
CELERY_TASK_EAGER_PROPAGATES = True
55+
56+
# Inference API
57+
# ------------------------------------------------------------------------------
58+
INFERENCE_API_URL = env("INFERENCE_API_URL", default="http://host.docker.internal:8000")
59+
5560
# Your stuff...
5661
# ------------------------------------------------------------------------------
5762

config/settings/production.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@
166166
traces_sample_rate=env.float("SENTRY_TRACES_SAMPLE_RATE", default=0.0),
167167
)
168168

169+
# Inference API
170+
# ------------------------------------------------------------------------------
171+
INFERENCE_API_URL = env("INFERENCE_API_URL", default="http://172.17.0.1:8000")
169172

170173
# Your stuff...
171174
# ------------------------------------------------------------------------------

sde_indexing_helper/static/js/collection_list.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,43 +138,47 @@ let table = $("#collection_table").DataTable({
138138
{
139139
label: "0 URLs",
140140
value: function (rowData, rowIdx) {
141-
return $(rowData[COLUMNS.DELTA_URLS]).text() == 0;
141+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) === 0;
142142
},
143143
},
144144
{
145145
label: "1 solo URL",
146146
value: function (rowData, rowIdx) {
147-
return $(rowData[COLUMNS.DELTA_URLS]).text() == 1;
147+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) === 1;
148148
},
149149
},
150150
{
151151
label: "1 to 100 URLs",
152152
value: function (rowData, rowIdx) {
153-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 100 && $(rowData[COLUMNS.DELTA_URLS]).text() > 1;
153+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
154+
return value > 1 && value <= 100;
154155
},
155156
},
156157
{
157158
label: "100 to 1,000 URLs",
158159
value: function (rowData, rowIdx) {
159-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 1000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 100;
160+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
161+
return value > 100 && value <= 1000;
160162
},
161163
},
162164
{
163165
label: "1,000 to 10,000 URLs",
164166
value: function (rowData, rowIdx) {
165-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 10000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 1000;
167+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
168+
return value > 1000 && value <= 10000;
166169
},
167170
},
168171
{
169172
label: "10,000 to 100,000 URLs",
170173
value: function (rowData, rowIdx) {
171-
return $(rowData[COLUMNS.DELTA_URLS]).text() <= 100000 && $(rowData[COLUMNS.DELTA_URLS]).text() > 10000;
174+
const value = parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']);
175+
return value > 10000 && value <= 100000;
172176
},
173177
},
174178
{
175179
label: "Over 100,000 URLs",
176180
value: function (rowData, rowIdx) {
177-
return $(rowData[COLUMNS.DELTA_URLS]).text() > 100000;
181+
return parseInt(rowData[COLUMNS.DELTA_URLS]['@data-order']) > 100000;
178182
},
179183
},
180184
],
@@ -189,43 +193,47 @@ let table = $("#collection_table").DataTable({
189193
{
190194
label: "0 URLs",
191195
value: function (rowData, rowIdx) {
192-
return $(rowData[COLUMNS.CURATED_URLS]).text() == 0;
196+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) === 0;
193197
},
194198
},
195199
{
196200
label: "1 solo URL",
197201
value: function (rowData, rowIdx) {
198-
return $(rowData[COLUMNS.CURATED_URLS]).text() == 1;
202+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) === 1;
199203
},
200204
},
201205
{
202206
label: "1 to 100 URLs",
203207
value: function (rowData, rowIdx) {
204-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1;
208+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
209+
return value > 1 && value <= 100;
205210
},
206211
},
207212
{
208213
label: "100 to 1,000 URLs",
209214
value: function (rowData, rowIdx) {
210-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 1000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 100;
215+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
216+
return value > 100 && value <= 1000;
211217
},
212218
},
213219
{
214220
label: "1,000 to 10,000 URLs",
215221
value: function (rowData, rowIdx) {
216-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 10000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 1000;
222+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
223+
return value > 1000 && value <= 10000;
217224
},
218225
},
219226
{
220227
label: "10,000 to 100,000 URLs",
221228
value: function (rowData, rowIdx) {
222-
return $(rowData[COLUMNS.CURATED_URLS]).text() <= 100000 && $(rowData[COLUMNS.CURATED_URLS]).text() > 10000;
229+
const value = parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']);
230+
return value > 10000 && value <= 100000;
223231
},
224232
},
225233
{
226234
label: "Over 100,000 URLs",
227235
value: function (rowData, rowIdx) {
228-
return $(rowData[COLUMNS.CURATED_URLS]).text() > 100000;
236+
return parseInt(rowData[COLUMNS.CURATED_URLS]['@data-order']) > 100000;
229237
},
230238
},
231239
],

sde_indexing_helper/templates/sde_collections/collection_list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ <h2 class="title">Welcome back!</h2>
151151
<td class="whiteText noBorder">{{ collection.get_division_display }}</td>
152152

153153
<!-- Delta URLs Column - Shows count and links if >= 0 -->
154-
<td class="noBorder centerAlign">
154+
<td class="noBorder centerAlign" data-order="{{ collection.num_delta_urls }}">
155155
<a href=" {% if collection.num_delta_urls >= 0 %} {% url 'sde_collections:delta_urls' collection.pk %} {% endif %} "
156156
class="btn btn-sm {% if collection.num_delta_urls >= 0 %}btn-primary {% else %}disabled{% endif %}candidateCount"
157157
role="button">{{ collection.num_delta_urls|intcomma }}</a>
158158
</td>
159159

160160
<!-- Curated URLs Column - Shows count and links if >= 0 -->
161-
<td class="noBorder centerAlign">
161+
<td class="noBorder centerAlign" data-order="{{ collection.num_curated_urls }}">
162162
<a href=" {% if collection.num_curated_urls >= 0 %} {% url 'sde_collections:delta_urls' collection.pk %} {% endif %} "
163163
class="btn btn-sm {% if collection.num_curated_urls >= 0 %}btn-primary {% else %}disabled{% endif %}candidateCount"
164164
role="button">{{ collection.num_curated_urls|intcomma }}</a>

0 commit comments

Comments
 (0)