View Single Post
Old 01-29-2022, 12:03 PM   #1
Wiggo
Leftutti
Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.Wiggo ought to be getting tired of karma fortunes by now.
 
Wiggo's Avatar
 
Posts: 549
Karma: 1717097
Join Date: Feb 2019
Location: Bavaria
Device: iPad Pro, Kobo Libra 2
Display bug with User Category

There's a strange bug in the book details with my alias column.
The name is cutted off, and it happens with this name only.

Edit: additional info

Code:
def evaluate(self, formatter, kwargs, mi, locals, val, col_name, user_cat_prefix):
    new_val = ''
    if hasattr(mi, '_proxy_metadata'):
        all_cats = mi._proxy_metadata.user_categories
        cats = {k:v for k,v in all_cats.items() if k.startswith(user_cat_prefix)}
        SEP = mi.metadata_for_field(col_name)['is_multiple'].get('list_to_ui', '')
        new_val = set()
        if SEP:
            val_ = val.split(SEP)
        else:
            val_ = [val]  
        for user_cat, v in cats.items():
            repl = user_cat.lstrip(user_cat_prefix)
            for user_cat_item, src_cat in v:
                if src_cat == col_name:
                    for item in val_[:]:
                        if item == user_cat_item:
                            new_val.add(repl)
                            val_.remove(item)
                        else:
                            new_val.add(item)
        if new_val:
            return ', '.join(list(new_val))
    return val
Attached Thumbnails
Click image for larger version

Name:	calibre_zNqOvThRIP.jpg
Views:	91
Size:	5.7 KB
ID:	191979   Click image for larger version

Name:	calibre_EWeXXHQVqG.jpg
Views:	96
Size:	5.2 KB
ID:	191981   Click image for larger version

Name:	calibre_S6O8W3hKRO.jpg
Views:	90
Size:	6.8 KB
ID:	191982   Click image for larger version

Name:	knMUiYt6y8.jpg
Views:	90
Size:	4.6 KB
ID:	191983   Click image for larger version

Name:	calibre_UNgm7HRiNo.jpg
Views:	83
Size:	37.5 KB
ID:	191984  

Last edited by Wiggo; 01-29-2022 at 12:14 PM.
Wiggo is offline   Reply With Quote