View Single Post
Old 09-18-2016, 03:29 AM   #1
oren64
I need a chapter break
oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.
 
oren64's Avatar
 
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
Build Custom Stars Rating Column.

I build custem stars column (text) from number float column using this function.

Code:
def evaluate(self, formatter, kwargs, mi, locals, r):
	try:
		m = float (r)
		n = int(m)
		if 0.00 <= m - n <= 0.25:
			x = n * '★' 
		if 0.25 < m - n <= 0.75:
			x = n * '★' +'½'
		if 0.75 < m - n <= 1.00:
			x = (n+1) * '★'
	except:
		x = ''
	return x
It works well but I have a few question:

- Is there a way to use an half star in text?

- The funny thing is that in the catrgory is show half stars rating, but it doesn't show any books.

- From 2.67 there is half star option in the custem star column, can I build star column from float column?
Attached Thumbnails
Click image for larger version

Name:	rt1.PNG
Views:	183
Size:	12.4 KB
ID:	151712   Click image for larger version

Name:	rt2.PNG
Views:	197
Size:	19.9 KB
ID:	151713  

Last edited by oren64; 09-18-2016 at 03:45 AM.
oren64 is offline   Reply With Quote