Code RoomRule loaded per item
MediumPrep Room Coding #1930

Rule loaded per item

Code reviewCode quality & reviewMid–Senior~18 min

Review this Python function that resolves and applies a discount rule for each item in a large cart batch. `load_rule` is an expensive parse of a rule blob.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 18 min
Mark a line and say what kind of problem it is.0 findings
1def price_items(items):
2 out = []
3 for item in items:
4 rule = load_rule(item.rule_id) # expensive: parses + compiles the rule
5 out.append(rule.apply(item.price))
6 return out
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.