Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

engineeringmodel.py 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. from django.db import models
  2. from polymorphic.models import PolymorphicModel
  3. import random
  4. # EngineeringModel und erbende Klassen
  5. class EngineeringModel(PolymorphicModel):
  6. name = models.CharField(default="random EngineeringModel", max_length=30)
  7. description = models.CharField(default="random description", max_length=200)
  8. pros = models.CharField(default="random pro", max_length=100)
  9. cons = models.CharField(default="random con", max_length=100)
  10. # wird bei zuweisen des models ausgelöst
  11. def recalculate(self, order, company):
  12. pass
  13. # wird bei workload berechnung ausgelöst, wenn workermodel nicht ordermodel
  14. def penalty(self, worker, order):
  15. worker.calculateHappyness(-5)
  16. def bonus(self, worker, order):
  17. pass
  18. def __str__(self):
  19. return self.name
  20. def getPros(self):
  21. return self.pros.split(",")
  22. def getCons(self):
  23. return self.cons.split(",")
  24. class ModelV(EngineeringModel):
  25. def recalculate(self, order, company):
  26. # positives
  27. # +10 workerSatisfaction +10 happyness
  28. company.calculateAllWorkersHappyness(addhappyness=10)
  29. company.calculateWorkerSatisfaction(number=10)
  30. # +10 customerSatisfaction
  31. company.calculateCustomerSatisfaction(10)
  32. # negatives
  33. # 1: extra work for SOPrototyp und SOChangeRequirement
  34. # +10% workload
  35. order.changeWorkload(1.1)
  36. order.recalculated = True
  37. order.save()
  38. company.save()
  39. class ModelSpiral(EngineeringModel):
  40. def recalculate(self, order, company):
  41. # positives
  42. # 1: BONUS AUF SOPrototyp UND SOChangeRequirement
  43. # +10 customerSatisfaciton
  44. company.calculateCustomerSatisfaction(10)
  45. # negatives
  46. # 1: -10 happyness and workersatisfaction
  47. company.calculateAllWorkersHappyness(addhappyness=-10)
  48. company.calculateWorkerSatisfaction(number=-10)
  49. # +10% workload
  50. order.changeWorkload(1.1)
  51. order.recalculated = True
  52. order.save()
  53. company.save()
  54. class ModelWaterfall(EngineeringModel):
  55. def recalculate(self, order, company):
  56. # positives
  57. # +10 workerSatisfaction +10 happyness
  58. company.calculateAllWorkersHappyness(addhappyness=10)
  59. company.calculateWorkerSatisfaction(number=10)
  60. # -10% workload
  61. order.changeWorkload(0.9)
  62. # negatives
  63. # 1: extra work for SOPrototyp und SOChangeRequirement
  64. # -10 customerSatisfaction
  65. company.calculateCustomerSatisfaction(-10)
  66. order.recalculated = True
  67. order.save()
  68. company.save()
  69. class ModelScrum(EngineeringModel):
  70. def recalculate(self, order, company):
  71. # positives
  72. # 1: BONUS bei SOPrototyp und SOChangeRequirement
  73. # 2: +20% if skilledModel of worker is scrum
  74. # IN BONUS HIER UNTEN
  75. # # negatives
  76. # 1: random workload shift zwischen 1% und +20%
  77. randnum = round(random.uniform(1.01, 1.2), 2)
  78. order.changeWorkload(randnum)
  79. # -40% auf skills wenn skilled model nicht scrum
  80. # IN ORDER.CALCULATEWORKLOAD
  81. order.recalculated = True
  82. order.save()
  83. company.save()
  84. def bonus(self, worker, order):
  85. ampnew = worker.amplifyer + 0.2
  86. return ampnew
  87. class ModelChaotic(EngineeringModel):
  88. def recalculate(self, order, company):
  89. # positives
  90. # NIX
  91. # negatives:
  92. # +10% workload
  93. order.changeWorkload(1.1)
  94. # -20 workerSatisfaction -10 happyness
  95. company.calculateAllWorkersHappyness(addhappyness=-10)
  96. company.calculateWorkerSatisfaction(number=-20)
  97. # extra work bei prototyp und changerequirement
  98. order.recalculated = True
  99. order.save()
  100. company.save()
  101. class ModelHeyJoe(EngineeringModel):
  102. def recalculate(self, order, company):
  103. # positives
  104. # 1: BONUS AUF SOPrototyp UND SOChangeRequirement
  105. # +30 customerSatisfaciton
  106. company.calculateCustomerSatisfaction(30)
  107. # negatives
  108. # 1: -10 happyness and workersatisfaction
  109. company.calculateAllWorkersHappyness(addhappyness=-15)
  110. company.calculateWorkerSatisfaction(number=-15)
  111. # +10% workload
  112. order.changeWorkload(1.2)
  113. order.recalculated = True
  114. order.save()
  115. company.save()