fix cross-selling recommendation logic bug

This commit is contained in:
Mira Weller
2024-07-18 20:49:58 +02:00
parent b8d2372cf6
commit 923798ea5f

View File

@@ -303,17 +303,15 @@ class Discount(LoggedModel):
if possible_applications_cond * self.benefit_only_apply_to_cheapest_n_matches > len(benefit_idx_group): if possible_applications_cond * self.benefit_only_apply_to_cheapest_n_matches > len(benefit_idx_group):
# unused discount ("for each 1 ticket you buy, get 50% on 2 t-shirts", cart content: 1 ticket # unused discount ("for each 1 ticket you buy, get 50% on 2 t-shirts", cart content: 1 ticket
# but 0 t-shirts) -> 2 shirt maybe potential discount (if the 1 ticket is not consumed by a later discount) # but 0 t-shirts) -> 2 shirt maybe potential discount (if the 1 ticket is not consumed by a later discount)
for i, idx in enumerate(condition_idx_group[
# n_groups * self.condition_min_count:
# TODO BUG: possible_applications_cond * self.condition_min_count
# cross-selling schlägt zu viele potential discounts vor ("consume" side of rule: sobald mindestens ]):
# ein voller block übrig ist zählt auch ein letzter, angebrochener block als voll mit) print(i, idx)
#
for i, idx in enumerate(condition_idx_group[n_groups * self.condition_min_count:]):
collect_potential_discounts[idx] += [ collect_potential_discounts[idx] += [
(self, self.benefit_only_apply_to_cheapest_n_matches, i // self.condition_min_count) (self, self.benefit_only_apply_to_cheapest_n_matches, i // self.condition_min_count)
] ]
print(collect_potential_discounts)
else: else:
consume_idx = condition_idx_group consume_idx = condition_idx_group