View Single Post
Old 04-23-2022, 01:59 AM   #377
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
What would be the best way to turn this into templates for the KoboTouch read estimates?

Code:
HoursMax = round(WordCount / 200 / 60)
HoursMin = HoursMax - 1
if (HoursMax >= 10) {
        HoursMax += round((HoursMax + .5) / 10) - 1)
}
I managed to get this so far, but my brain isn't cooperating at the moment

Code:
program: round(divide(divide($#wordcount, 200), 60))
Note that the code you want translated has unbalanced parentheses on line 4. I removed the one after '-1'.
Code:
program:
	HoursMax = round($$#wordcount / 200 / 60);
	HoursMin = HoursMax - 1;
	if (HoursMax >= 10) then
	        HoursMax = HoursMax + round((HoursMax + .5) / 10) - 1
	fi
The template language doesn't do constant folding so for performance the first HoursMax line should be written
Code:
	HoursMax = round($$#wordcount / 12000);
chaley is offline   Reply With Quote