View Single Post
Old 07-07-2021, 01:40 AM   #132
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: 11,110
Karma: 77213681
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Also:

Code:
program:

input = $#kobobookmark;
a = re(input, '.*\/file(\d+).*', '\1');
status = $#fanficstatus;
ccount = $$#chaptercount;

	if 
		$#fanficcat
	then
		if		
				!status inlist 'Anthology,Oneshot'
			&& 	
				substr(input, 0, 10) == 'OEBPS/file'
			&& 
				$#currentlyreading 
		then		
			strcat(format_number(subtract(a, 1), '{0:,d}'), '/',ccount)
		else
			ccount
		fi

	elif
		ccount >#1
	then
  		ccount
	fi
I might've asked this before, but does it do all the checks, or only continue the check when it passes the other ones?

If the latter, since #currentlyreading is another composite (psuedobool, it returns 'true' if it passes certain checks), would putting it last be better practice for performance?

Also, are there any other improvements that can be made to this? I notice there's a slight delay whenever the column updates. I've thought of taking out the #currentlyreading check and instead just having it run its checks directly, but I'm not sure if that would help or if there's a better way.

description of template:
Spoiler:
What I'm doing here is:

Check whether or not it's a fanfiction (#fanficcat defined).

If it is, check for three things:

a) Status is not 'Anthology' or 'Oneshot.'
b) #kobobookmark starts with 'OEBPS/file'
c) #currentlyreading is defined

If all three of these are true, do that number formatting stuff; this shows how many chapters I've read compared to how many there are (e.g. 23/25).

If it's a fanfiction but does not fulfill all three checks, display the chapter count.

If it's not a fanfiction, display the chapter count only if it's above 1.

Last edited by ownedbycats; 07-07-2021 at 04:41 AM.
ownedbycats is offline   Reply With Quote