View Single Post
Old 02-15-2021, 08:27 AM   #8
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Or if you want weighted rating system as davidfor post suggests, discard the previous post and do this instead:
  • Create a new tag-like custom column called #all_ratings. This column should contain the ratings from different sources as suggested by davidfor:
    Code:
    Bill Gates=4, Naval Ravicant=4, Goodreads=3.9
  • Create a composite column called #weighted_rating. Set the sorting of this column to numbers. Use the following template for this column:
    Code:
    program:
        total = 0;
        cnt = 0;
        default_weight = 1;
        weights = 'Bill Gates:5,Naval Ravicant:10,Goodreads:1';
        for rec in '#all_ratings':
            source = re(rec,'(.+)=.+', '\1');
            rating = re(rec,'.+=(.+)', '\1');
            weight = ifempty(select(weights, source), default_weight);
            increment = multiply(rating, weight);
            total = add(total, increment);
            cnt = add(cnt, weight)
        rof;
        if cnt != 0 then
            divide(total, cnt)
        else
            '0'
        fi
    This template should calculate the a weighted rating for you in the new composite column.

    Note that the line in blue is a comma separated pairs in the form of source:weight. You must edit this to suit your needs. Every time you have a new source, you need to update this line in the template.

    The line in green is the weight assigned to sources with no defined weight e.g random people from the internet. Edit the value to suit your needs.

Note: You will need a recent version of calibre for this template to work. It uses a for loop which was introduced recently and not available on older versions.

Also note that the recommendations are case-sensitive. So: Bill Gates is not the same as bill gates.

Last edited by capink; 02-15-2021 at 08:36 AM.
capink is offline   Reply With Quote