diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-08 11:18:20 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-24 12:06:09 +0200 |
commit | f9debe827556003e37493290b1e29fb5b9741e88 (patch) | |
tree | 42def1e68d0252237904317a2554418a9592c6c8 /archaeological_finds | |
parent | f2f6b7c1c491a1a740d33cda3b0613f9d631c137 (diff) | |
download | Ishtar-f9debe827556003e37493290b1e29fb5b9741e88.tar.bz2 Ishtar-f9debe827556003e37493290b1e29fb5b9741e88.zip |
Optionnal use of indexes for cached label for finds
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models_finds.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index bea9b8048..26993aa32 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1382,6 +1382,12 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, profile = get_current_profile() + index = "" + if profile.find_use_index: + index = """|| '-' || + to_char(find_cached_bulk_update.index, 'fm{zeros}') + """.format(zeros=settings.ISHTAR_FINDS_INDEX_ZERO_LEN * "0") + sql = """ UPDATE "archaeological_finds_find" AS f SET cached_label = @@ -1404,8 +1410,7 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, '{main_ope_prefix}' || find_cached_bulk_update.main_ope_code END - || '-' || - to_char(find_cached_bulk_update.index, 'fm{zeros}') + {index} || '{join}' || find_cached_bulk_update.label @@ -1419,7 +1424,7 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, """.format(main_ope_prefix=profile.operation_prefix, ope_prefix=profile.default_operation_prefix, join=settings.JOINT, filters=filters, - zeros=settings.ISHTAR_FINDS_INDEX_ZERO_LEN * "0") + index=index) with connection.cursor() as c: c.execute(sql, args) |