fix: Revert naming for custom naming series

This commit is contained in:
shariquerik 2021-05-06 16:44:18 +05:30
parent 59e9a2520b
commit 483cd85eba

View file

@ -202,7 +202,12 @@ def revert_series_if_last(key, name, doc=None):
if ".#" in key:
prefix, hashes = key.rsplit(".", 1)
if "#" not in hashes:
return
key = key.rsplit(".")
hash = list(filter(re.compile(".*#").match, key))[0]
if not hash:
return
name = name.replace(hashes, "")
prefix, hashes = key[:key.index(hash)+1]
else:
prefix = key