View Single Post
Old 05-11-2024, 08:40 PM   #665
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,507
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
A template has stopped working.
I was using the formula from this thread https://www.mobileread.com/forums/sh...&postcount=574

Code:
python:
def evaluate(book, context):
	vals = context.funcs.book_values('#ranking', 'title:true', '&', 0).split('&')
	vals = sorted([float(v) for v in vals], reverse=True)
	return str(1 + vals.index(float(book.get('#ranking'))))

to calculate the ranking position and now it says that there is an error on line 4
Give me a hand with the solution
It would be helpful if you provided the actual error message.

Edit: an error will be thrown if #ranking contains something that isn't a number

Last edited by chaley; 05-11-2024 at 08:44 PM.
chaley is offline   Reply With Quote