Skip to content

Commit

Permalink
Use natural sort when access fastest media (#2336)
Browse files Browse the repository at this point in the history
* Use natural sort when access fastest media

* Fix mediamigrations IP order
  • Loading branch information
henrikek authored Oct 24, 2024
1 parent 952e192 commit 09e573a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ESSArch_Core/frontend/static/frontend/lang/sv/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default ($translateProvider: ng.translate.ITranslateProvider) => {
EXPORT: 'Export',
EXPORT_AS_JSON: 'Exportera som JSON',
EXPORT_PROFILE: 'Exportera profil',
EXPORT_SUBMISSION_AGREEMENT: 'Exportera leveransöverenskollelse',
EXPORT_SUBMISSION_AGREEMENT: 'Exportera leveransöverenskommelse',
},
});
};
15 changes: 8 additions & 7 deletions ESSArch_Core/storage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ def migratable(self, export_path='', missing_storage=False):
def non_migratable(self):
return self.exclude(pk__in=self.migratable())

def natural_sort(self):
return natural_sort(self, 'medium_id')
def natural_sort(self, column='medium_id'):
return natural_sort(self, column)

def fastest(self):
container = Case(
Expand Down Expand Up @@ -734,8 +734,8 @@ def readable(self):
storage_medium__status__in=[20, 30]
)

def natural_sort(self):
return natural_sort(self, 'content_location_value')
def natural_sort(self, column='content_location_value'):
return natural_sort(self, column)

def fastest(self):
container = Case(
Expand Down Expand Up @@ -763,7 +763,8 @@ def fastest(self):
remote=remote,
storage_type=storage_type,
content_location_value_int=content_location_value_int,
).order_by('remote', 'container_order', 'storage_type', 'storage_medium', 'content_location_value_int')
).order_by('remote', 'container_order', 'storage_type').natural_sort('storage_medium__medium_id'
).order_by('content_location_value_int')


class StorageObject(models.Model):
Expand Down Expand Up @@ -1092,8 +1093,8 @@ def __str__(self):


class TapeSlotQueryset(models.QuerySet):
def natural_sort(self):
return natural_sort(self, 'medium_id')
def natural_sort(self, column='medium_id'):
return natural_sort(self, column)


class TapeSlot(models.Model):
Expand Down

0 comments on commit 09e573a

Please sign in to comment.