View Single Post
Old 12-04-2023, 07:07 AM   #348
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,234
Karma: 1419583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by dunhill View Post
Hello @thiago.eec, I'm telling you a question I have.
I have Calibre linked to goodreads but I don't use the reading process, so when I finish reading a book in my calibre I have a status column that will say Read.
Create a custom column for the reading process that depends on the Status column, if it says Read it puts 100 and determines it in numbers.
But I see that I am not taking well the number of books for the month of November.
What could be causing the problem?
Hi, @duhill.

I assume your 'goodreadtags' column has multiple values (tags-like), right? Then your template might fail because it compares the whole value of the column. So, if you only have 'Leído' in this column, it will work, but if you have multiple values, like 'Bueno, Leído', it fails.

Check if your '#progresos' column is really showing '100' for all the five books. If not, you can correct it changing 'switch_if' for 'in_list':
Code:
{#goodreadtags:'in_list($, ',', 'Leído', '100', '')'}
P.S.: The above function still has a small problem... if the searched string is part of a larger string, it still matches (e.g.: it would match 'Leídoo' too). Since I'm not very good with the template language, I can suggest something using the Python Mode that will work perfectly, although it might look more complicated:

Code:
python:
def evaluate(book, context):
	if book.get('#goodreadtags'):
		if 'Leído' in book.get('#goodreadtags'):
			return '100'
		else:
			return ''
	else:
		return ''
I'm not sure about the performance difference, though.

Last edited by thiago.eec; 12-04-2023 at 07:10 AM.
thiago.eec is offline   Reply With Quote