我有两个模型 - Score& Weight。
这些模型中的每一个都有大约 5 个属性。
我需要能够weighted_score为 my创建一个User,这基本上是Score.attribute_A* Weight.attribute_A,Score.attribute_B*Weight.attribute_B等的产品。
我最好创建第三个模型 - 比如说Weighted_Score,我将每个属性的产品值存储在一行中user_id,然后在我需要特定weighted_score(例如my_user.weighted_score.attribute_A)时查询该表,或者我最好只是动态进行计算每次?
我是从效率的角度来问的。
谢谢。