rank = defaultdict(dict)
pk_val = namedtuple("pk_val", ["pk", "val"])
if len(queryset) == 0:
// No results to calculate
return rank
for (metric_path, reverse) in zip(metric_paths, metric_reverse):
// Extract the value of the metric for this primary key and sort on the
// value of the metric
pk_vals = [
After Change
current_rank = 1
except IndexError:
// No results to work with for this metric
continue
for idx, result_pk_val in enumerate(pk_vals):
// If the values of the metrics are the same, keep the rank