Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old Today, 09:50 AM   #736
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,420
Karma: 64488089
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
I'm not sure what you are asking.

If you are asking if it would be faster to use field_list_count() instead of $$#timesread then the answer is yes. In the best case where $$#timesread has already been evaluated for the book then the performance improvement will be around 2 times. If $$#timesread hasn't yet been evaluated for the book then the performance improvement is at least 10 times.

If you are using $#timesread (not raw_field()) then the performance improvement of using field_list_count() directly is probably 10 to 100 times.
Yes, specifically line three here:

Code:
program:
	status = readstatus();
	times = field_list_count('#datesread');
	readgoal = strcat('readinggoal:', format_date(today(), 'yyyy')) in $#admintags;

	switch_if(
		status=='read', 'Read',
		status=='didnotfinish', 'Did Not Finish',
		status=='currentlyreading', 
			if times >#0 then 'Currently Rereading' 
			else 'Currently Reading' fi,
		status=='toberead', 'To Be Read',
		status=='unread', 
			if readgoal && $$#lastread != 'None' then 'To Be Read' 
			elif readgoal then 'Backlog' 
			else 'Unread' fi,
		''
	)
When #timesread column used to be an integer, I used that for 'times.' Now that it's a composite, I switched to using field_list_count() directly.

I just realized I could probably speed up this template a nudge by turning those nested if-thens into switch_ifs.
ownedbycats is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Library Management: various questions not worth their own thread ownedbycats Library Management 159 10-18-2024 05:40 PM
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates Boilerplate4U Development 13 07-07-2020 02:35 AM
Questions on Kobo [Interfered with another thread topic] spdavies Kobo Reader 8 10-12-2014 11:37 AM
[OLD Thread] Some questions before buying the fire. darthreader13 Kindle Fire 7 05-10-2013 09:19 PM
Thread management questions meme Feedback 6 01-31-2011 05:07 PM


All times are GMT -4. The time now is 02:40 PM.


MobileRead.com is a privately owned, operated and funded community.