Skip to content

Commit

Permalink
Skills: change skills from amount to percentage over base amount
Browse files Browse the repository at this point in the history
  • Loading branch information
abernardi committed May 24, 2023
1 parent f022a67 commit 9a00ef1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
20 changes: 10 additions & 10 deletions configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ class ConfigurationSkill(ModelSingleton, ModelSQL, ModelView):
'Cooperative Skill Configuration'
__name__ = 'cooperative_ar.configuration.skill'

skill_01 = fields.Numeric('Skill 1 Amount', digits=(16, 2))
skill_02 = fields.Numeric('Skill 2 Amount', digits=(16, 2))
skill_03 = fields.Numeric('Skill 3 Amount', digits=(16, 2))
skill_04 = fields.Numeric('Skill 4 Amount', digits=(16, 2))
skill_05 = fields.Numeric('Skill 5 Amount', digits=(16, 2))
skill_06 = fields.Numeric('Skill 6 Amount', digits=(16, 2))
skill_07 = fields.Numeric('Skill 7 Amount', digits=(16, 2))
skill_08 = fields.Numeric('Skill 8 Amount', digits=(16, 2))
skill_09 = fields.Numeric('Skill 9 Amount', digits=(16, 2))
skill_10 = fields.Numeric('Skill 10 Amount', digits=(16, 2))
skill_01 = fields.Numeric('Skill 1 %', digits=(16, 2))
skill_02 = fields.Numeric('Skill 2 %', digits=(16, 2))
skill_03 = fields.Numeric('Skill 3 %', digits=(16, 2))
skill_04 = fields.Numeric('Skill 4 %', digits=(16, 2))
skill_05 = fields.Numeric('Skill 5 %', digits=(16, 2))
skill_06 = fields.Numeric('Skill 6 %', digits=(16, 2))
skill_07 = fields.Numeric('Skill 7 %', digits=(16, 2))
skill_08 = fields.Numeric('Skill 8 %', digits=(16, 2))
skill_09 = fields.Numeric('Skill 9 %', digits=(16, 2))
skill_10 = fields.Numeric('Skill 10 %', digits=(16, 2))
39 changes: 26 additions & 13 deletions partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,43 @@ def on_change_with_recibo_total(self, name=None):
pool = Pool()
ConfigurationSkill = pool.get('cooperative_ar.configuration.skill')

recibo_base = self.recibo_base
if not recibo_base:
return Decimal(0)

configuration = ConfigurationSkill(1)
amount = recibo_base
quantize = Decimal(10) ** -Decimal(2)

amount = Decimal(0)
if self.recibo_base:
amount += self.recibo_base
if self.skill_01 and configuration.skill_01:
amount += configuration.skill_01
amount += (recibo_base * configuration.skill_01 /
Decimal(100)).quantize(quantize)
if self.skill_02 and configuration.skill_02:
amount += configuration.skill_02
amount += (recibo_base * configuration.skill_02 /
Decimal(100)).quantize(quantize)
if self.skill_03 and configuration.skill_03:
amount += configuration.skill_03
amount += (recibo_base * configuration.skill_03 /
Decimal(100)).quantize(quantize)
if self.skill_04 and configuration.skill_04:
amount += configuration.skill_04
amount += (recibo_base * configuration.skill_04 /
Decimal(100)).quantize(quantize)
if self.skill_05 and configuration.skill_05:
amount += configuration.skill_05
amount += (recibo_base * configuration.skill_05 /
Decimal(100)).quantize(quantize)
if self.skill_06 and configuration.skill_06:
amount += configuration.skill_06
amount += (recibo_base * configuration.skill_06 /
Decimal(100)).quantize(quantize)
if self.skill_07 and configuration.skill_07:
amount += configuration.skill_07
amount += (recibo_base * configuration.skill_07 /
Decimal(100)).quantize(quantize)
if self.skill_08 and configuration.skill_08:
amount += configuration.skill_08
amount += (recibo_base * configuration.skill_08 /
Decimal(100)).quantize(quantize)
if self.skill_09 and configuration.skill_09:
amount += configuration.skill_09
amount += (recibo_base * configuration.skill_09 /
Decimal(100)).quantize(quantize)
if self.skill_10 and configuration.skill_10:
amount += configuration.skill_10
amount += (recibo_base * configuration.skill_10 /
Decimal(100)).quantize(quantize)

return amount

0 comments on commit 9a00ef1

Please sign in to comment.