Skip to content

Commit 0e33fe5

Browse files
committed
add new field to reindexing statuses
1 parent c316960 commit 0e33fe5

File tree

6 files changed

+142
-20
lines changed

6 files changed

+142
-20
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Generated by Django 4.2.9 on 2024-12-13 19:57
2+
3+
from django.db import migrations, models
4+
5+
6+
def migrate_reindexing_statuses(apps, schema_editor):
7+
Collection = apps.get_model("sde_collections", "Collection")
8+
ReindexingHistory = apps.get_model("sde_collections", "ReindexingHistory")
9+
10+
# Update Collections
11+
Collection.objects.filter(reindexing_status=6).update(reindexing_status=7) # Move "Indexed on Prod" first
12+
Collection.objects.filter(reindexing_status=5).update(reindexing_status=6) # Then move "Curated"
13+
# 5 is now free for "Curation in Progress"
14+
15+
# Update ReindexingHistory
16+
ReindexingHistory.objects.filter(reindexing_status=6).update(reindexing_status=7)
17+
ReindexingHistory.objects.filter(reindexing_status=5).update(reindexing_status=6)
18+
19+
ReindexingHistory.objects.filter(old_status=6).update(old_status=7)
20+
ReindexingHistory.objects.filter(old_status=5).update(old_status=6)
21+
22+
23+
def reverse_migrate_reindexing_statuses(apps, schema_editor):
24+
Collection = apps.get_model("sde_collections", "Collection")
25+
ReindexingHistory = apps.get_model("sde_collections", "ReindexingHistory")
26+
27+
# Reverse Collections
28+
Collection.objects.filter(reindexing_status=5).update(reindexing_status=None) # Clear new status
29+
Collection.objects.filter(reindexing_status=6).update(reindexing_status=5)
30+
Collection.objects.filter(reindexing_status=7).update(reindexing_status=6)
31+
32+
# Reverse ReindexingHistory
33+
ReindexingHistory.objects.filter(reindexing_status=5).update(reindexing_status=None)
34+
ReindexingHistory.objects.filter(reindexing_status=6).update(reindexing_status=5)
35+
ReindexingHistory.objects.filter(reindexing_status=7).update(reindexing_status=6)
36+
37+
ReindexingHistory.objects.filter(old_status=5).update(old_status=None)
38+
ReindexingHistory.objects.filter(old_status=6).update(old_status=5)
39+
ReindexingHistory.objects.filter(old_status=7).update(old_status=6)
40+
41+
42+
class Migration(migrations.Migration):
43+
44+
dependencies = [
45+
("sde_collections", "0074_alter_collection_reindexing_status_and_more"),
46+
]
47+
48+
operations = [
49+
migrations.RunPython(migrate_reindexing_statuses, reverse_migrate_reindexing_statuses),
50+
migrations.AlterField(
51+
model_name="collection",
52+
name="reindexing_status",
53+
field=models.IntegerField(
54+
choices=[
55+
(1, "Re-Indexing Not Needed"),
56+
(2, "Re-Indexing Needed"),
57+
(3, "Re-Indexing Finished"),
58+
(4, "Ready for Re-Curation"),
59+
(5, "Re-Curation in Progress"),
60+
(6, "Re-Curation Finished"),
61+
(7, "Re-Indexed on Prod"),
62+
],
63+
default=1,
64+
verbose_name="Reindexing Status",
65+
),
66+
),
67+
migrations.AlterField(
68+
model_name="reindexinghistory",
69+
name="old_status",
70+
field=models.IntegerField(
71+
choices=[
72+
(1, "Re-Indexing Not Needed"),
73+
(2, "Re-Indexing Needed"),
74+
(3, "Re-Indexing Finished"),
75+
(4, "Ready for Re-Curation"),
76+
(5, "Re-Curation in Progress"),
77+
(6, "Re-Curation Finished"),
78+
(7, "Re-Indexed on Prod"),
79+
],
80+
null=True,
81+
),
82+
),
83+
migrations.AlterField(
84+
model_name="reindexinghistory",
85+
name="reindexing_status",
86+
field=models.IntegerField(
87+
choices=[
88+
(1, "Re-Indexing Not Needed"),
89+
(2, "Re-Indexing Needed"),
90+
(3, "Re-Indexing Finished"),
91+
(4, "Ready for Re-Curation"),
92+
(5, "Re-Curation in Progress"),
93+
(6, "Re-Curation Finished"),
94+
(7, "Re-Indexed on Prod"),
95+
],
96+
default=1,
97+
),
98+
),
99+
]

sde_collections/models/README_REINDEXING_STATUSES.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Reindexing Status Documentation
22

3+
### Status Flow
4+
5+
The typical reindexing status flow is:
6+
7+
1. `REINDEXING_NOT_NEEDED` ("Re-Indexing Not Needed") → Default state
8+
2. `REINDEXING_NEEDED_ON_DEV` ("Re-Indexing Needed") → When reindexing is required
9+
3. `REINDEXING_FINISHED_ON_DEV` ("Re-Indexing Finished") → After reindexing completes
10+
4. `REINDEXING_READY_FOR_CURATION` ("Ready for Re-Curation") → After dump URLs are migrated
11+
5. `REINDEXING_CURATION_IN_PROGRESS` ("Re-Curation in Progress") → During active re-curation
12+
6. `REINDEXING_CURATED` ("Re-Curation Finished") → After re-curation is complete
13+
7. `REINDEXING_INDEXED_ON_PROD` ("Re-Indexed on Prod") → After successful prod indexing
14+
15+
## Status Descriptions
316
### Reindexing Not Needed
417
- Variable name: `REINDEXING_NOT_NEEDED` (1)
518
- Default status for new collections
@@ -15,20 +28,26 @@
1528
- For collections that have completed reindexing on LRM Dev
1629
- Currently managed manually by LRM team via admin interface
1730

18-
### Ready for Curation
31+
### Ready for Re-Curation
1932
- Variable name: `REINDEXING_READY_FOR_CURATION` (4)
2033
- Automatically set when:
2134
- A collection's dump URLs are migrated to delta URLs AND there are curated URLs present
2235
- Triggered by Collection.migrate_dump_to_delta() method
2336

24-
### Curated
25-
- Variable name: `REINDEXING_CURATED` (5)
37+
### Re-Curation in Progress
38+
- Variable name: `REINDEXING_CURATION_IN_PROGRESS` (5)
39+
- Indicates that collection is actively being re-curated
40+
- Manually set when curator begins re-curation work
41+
- Transitions to `REINDEXING_CURATED` when re-curation is complete
42+
43+
### Re-Curation Finished
44+
- Variable name: `REINDEXING_CURATED` (6)
2645
- Automatically set when:
2746
- Delta URLs are promoted to curated URLs AND there are curated URLs present
2847
- Triggered by Collection.promote_to_curated() method
2948

30-
### Indexed on Prod
31-
- Variable name: `REINDEXING_INDEXED_ON_PROD` (6)
49+
### Re-Indexed on Prod
50+
- Variable name: `REINDEXING_INDEXED_ON_PROD` (7)
3251
- Currently managed manually via command line
3352
- Future: Will be set automatically via plugin ping
3453

sde_collections/models/collection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ def reindexing_status_button_color(self) -> str:
350350
2: "btn-warning", # NEEDED
351351
3: "btn-secondary", # FINISHED
352352
4: "btn-info", # READY_FOR_CURATION
353-
5: "btn-primary", # CURATED
354-
6: "btn-success", # INDEXED_ON_PROD
353+
5: "btn-warning", # CURATION_IN_PROGRESS
354+
6: "btn-primary", # CURATED
355+
7: "btn-success", # INDEXED_ON_PROD
355356
}
356357
return color_choices[self.reindexing_status]
357358

sde_collections/models/collection_choice_fields.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ class ReindexingStatusChoices(models.IntegerChoices):
105105
REINDEXING_NEEDED_ON_DEV = 2, "Re-Indexing Needed"
106106
REINDEXING_FINISHED_ON_DEV = 3, "Re-Indexing Finished"
107107
REINDEXING_READY_FOR_CURATION = 4, "Ready for Re-Curation"
108-
REINDEXING_CURATED = 5, "Re-Curation Finished"
109-
REINDEXING_INDEXED_ON_PROD = 6, "Re-Indexed on Prod"
108+
REINDEXING_CURATION_IN_PROGRESS = 5, "Re-Curation in Progress"
109+
REINDEXING_CURATED = 6, "Re-Curation Finished"
110+
REINDEXING_INDEXED_ON_PROD = 7, "Re-Indexed on Prod"
110111

111112
# @classmethod
112113
# def get_status_string(cls, value):

sde_indexing_helper/static/js/collection_list.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,13 @@ function handleReindexingStatusSelect() {
304304
var reindexing_status = $(this).attr("value");
305305
var reindexing_status_text = $(this).text();
306306
var color_choices = {
307-
1: "btn-light", // REINDEXING_NOT_NEEDED
308-
2: "btn-warning", // REINDEXING_NEEDED_ON_DEV
307+
1: "btn-light", // REINDEXING_NOT_NEEDED
308+
2: "btn-warning", // REINDEXING_NEEDED_ON_DEV
309309
3: "btn-secondary", // REINDEXING_FINISHED_ON_DEV
310-
4: "btn-info", // REINDEXING_READY_FOR_CURATION
311-
5: "btn-primary", // REINDEXING_CURATED
312-
6: "btn-success", // REINDEXING_INDEXED_ON_PROD
310+
4: "btn-info", // REINDEXING_READY_FOR_CURATION
311+
5: "btn-warning", // REINDEXING_CURATION_IN_PROGRESS
312+
6: "btn-primary", // REINDEXING_CURATED
313+
7: "btn-success" // REINDEXING_INDEXED_ON_PROD
313314
};
314315

315316
$possible_buttons = $("body").find(

sde_indexing_helper/static/js/delta_url_list.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,12 +2218,13 @@ function handleReindexingStatusSelect() {
22182218
break;
22192219
case "changeReindexingStatus":
22202220
var color_choices = {
2221-
1: "btn-light", // NOT_NEEDED
2222-
2: "btn-warning", // NEEDED
2223-
3: "btn-secondary",// FINISHED
2224-
4: "btn-info", // READY_FOR_CURATION
2225-
5: "btn-primary", // CURATED
2226-
6: "btn-success" // INDEXED_ON_PROD
2221+
1: "btn-light", // REINDEXING_NOT_NEEDED
2222+
2: "btn-warning", // REINDEXING_NEEDED_ON_DEV
2223+
3: "btn-secondary", // REINDEXING_FINISHED_ON_DEV
2224+
4: "btn-info", // REINDEXING_READY_FOR_CURATION
2225+
5: "btn-warning", // REINDEXING_CURATION_IN_PROGRESS
2226+
6: "btn-primary", // REINDEXING_CURATED
2227+
7: "btn-success" // REINDEXING_INDEXED_ON_PROD
22272228
};
22282229

22292230
$button = $(`#reindexing-status-button-${collection_id}`);

0 commit comments

Comments
 (0)