View Single Post
Old 12-17-2025, 05:39 AM   #93
bnmbnmbnmbnm
Junior Member
bnmbnmbnmbnm began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Jan 2021
Device: bnm
Quote:
Originally Posted by bnmbnmbnmbnm View Post
Ahoj, zdá se, že se špatně počítají procentní hodnocení, nepočítajíce s půlhvězdičkami.
Pomohlo mi tedy přidání řádku do funkce def parse_recalculated_rating(self, root):
ratingstars = self.parse_all(root, '//table[@class="morePadding"]//tr/td[1]/text()', 'ratingstars', convert=lambda x: [float(node.strip().replace(' ', '')) if node.strip() else 0.0 for node in x][::-1])
A změna
rating5 = (sum([x * y for x, y in zip(ratings, ratingstars)])/sum(ratings)) if ratings else 0
(bez záruky)
bnmbnmbnmbnm is offline   Reply With Quote