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.

offer.py 905B

1 year ago
12345678910111213141516171819202122232425
  1. from django.db import models
  2. from .event import EventOfferAccepted
  3. # offer für orders
  4. class Offer(models.Model):
  5. company = models.ForeignKey("Company", default=1, on_delete=models.CASCADE)
  6. amount = models.IntegerField(default=0)
  7. order = models.ForeignKey("Order", default=1, on_delete=models.CASCADE)
  8. def offerAcceptedEvent(self):
  9. name = "Offer for " + self.order.name
  10. description = (
  11. "Your offer for the order "
  12. + self.order.name
  13. + " has been accepted!"
  14. + " You have "
  15. + str(self.order.maxRounds)
  16. + " rounds time to finish the order and claim your profit of "
  17. + str(self.order.profit)
  18. )
  19. offeracceptedevent = EventOfferAccepted.objects.create(
  20. name=name, description=description, order=self.order
  21. )
  22. self.company.addEvent(offeracceptedevent)