prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Correct exception for quantity < max order in tickets schema
  **Describe the bug**
  <!-- A clear and concise description of what the bug is. -->
  Validation check message for quantity to be more than max-order needs to be corrected.
  
  **To Reproduce**
  A validation check for quantity and max-order is:
  ```
          if 'quantity' in data and 'max_order' in data:
              if data['quantity'] < data['max_order']:
                  raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
                                            "quantity should be lesser than max-order")
  ```
  
  **Expected behavior**
  <!-- A clear and concise description of what you expected to happen. -->
  The message should be: "quantity should not be lesser than max-order".
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `app/api/schema/tickets.py`
  Content:
  ```
  1 from marshmallow import validates_schema
  2 from marshmallow_jsonapi import fields
  3 from marshmallow_jsonapi.flask import Relationship
  4 from sqlalchemy.orm.exc import NoResultFound
  5 
  6 from app.api.helpers.exceptions import UnprocessableEntity
  7 from app.api.helpers.utilities import dasherize
  8 from app.api.schema.base import SoftDeletionSchema
  9 from app.models.discount_code import DiscountCode
  10 from app.models.ticket import Ticket
  11 from utils.common import use_defaults
  12 
  13 
  14 @use_defaults()
  15 class TicketSchemaPublic(SoftDeletionSchema):
  16     class Meta:
  17         type_ = 'ticket'
  18         self_view = 'v1.ticket_detail'
  19         self_view_kwargs = {'id': '<id>'}
  20         inflect = dasherize
  21 
  22     @validates_schema(pass_original=True)
  23     def validate_date(self, data, original_data):
  24         if 'id' in original_data['data']:
  25             ticket = Ticket.query.filter_by(id=original_data['data']['id']).one()
  26 
  27             if 'sales_starts_at' not in data:
  28                 data['sales_starts_at'] = ticket.sales_starts_at
  29 
  30             if 'sales_ends_at' not in data:
  31                 data['sales_ends_at'] = ticket.sales_ends_at
  32 
  33         if data['sales_starts_at'] >= data['sales_ends_at']:
  34             raise UnprocessableEntity({'pointer': '/data/attributes/sales-ends-at'},
  35                                       "sales-ends-at should be after sales-starts-at")
  36 
  37     @validates_schema
  38     def validate_quantity(self, data):
  39         if 'max_order' in data and 'min_order' in data:
  40             if data['max_order'] < data['min_order']:
  41                 raise UnprocessableEntity({'pointer': '/data/attributes/max-order'},
  42                                           "max-order should be greater than min-order")
  43 
  44         if 'quantity' in data and 'min_order' in data:
  45             if data['quantity'] < data['min_order']:
  46                 raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
  47                                           "quantity should be greater than min-order")
  48 
  49         if 'quantity' in data and 'max_order' in data:
  50             if data['quantity'] < data['max_order']:
  51                 raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
  52                                           "quantity should be lesser than max-order")
  53 
  54     @validates_schema(pass_original=True)
  55     def validate_discount_code(self, data, original_data):
  56         if 'relationships' in original_data and 'discount-codes' in original_data['data']['relationships']:
  57             discount_codes = original_data['data']['relationships']['discount-codes']
  58             for code in discount_codes['data']:
  59                 try:
  60                     DiscountCode.query.filter_by(id=code['id']).one()
  61                 except NoResultFound:
  62                     raise UnprocessableEntity(
  63                         {'pointer': '/data/relationships/discount-codes'}, "Discount code does not exist")
  64 
  65     id = fields.Str(dump_only=True)
  66     name = fields.Str(required=True)
  67     description = fields.Str(allow_none=True)
  68     type = fields.Str(required=True)
  69     price = fields.Float(validate=lambda n: n >= 0, allow_none=True)
  70     quantity = fields.Integer(validate=lambda n: n >= 0, allow_none=True)
  71     is_description_visible = fields.Boolean(default=False)
  72     position = fields.Integer(allow_none=True)
  73     is_fee_absorbed = fields.Boolean()
  74     sales_starts_at = fields.DateTime(required=True)
  75     sales_ends_at = fields.DateTime(required=True)
  76     is_hidden = fields.Boolean(default=False)
  77     min_order = fields.Integer(validate=lambda n: n >= 0, allow_none=True)
  78     max_order = fields.Integer(validate=lambda n: n >= 0, allow_none=True)
  79     is_checkin_restricted = fields.Boolean(default=True)
  80     auto_checkin_enabled = fields.Boolean(default=False)
  81     event = Relationship(attribute='event',
  82                          self_view='v1.ticket_event',
  83                          self_view_kwargs={'id': '<id>'},
  84                          related_view='v1.event_detail',
  85                          related_view_kwargs={'ticket_id': '<id>'},
  86                          schema='EventSchemaPublic',
  87                          type_='event')
  88 
  89     ticket_tags = Relationship(attribute='tags',
  90                                self_view='v1.ticket_ticket_tag',
  91                                self_view_kwargs={'id': '<id>'},
  92                                related_view='v1.ticket_tag_list',
  93                                related_view_kwargs={'ticket_id': '<id>'},
  94                                schema='TicketTagSchema',
  95                                many=True,
  96                                type_='ticket-tag')
  97 
  98     discount_codes = Relationship(
  99         attribute='discount_codes',
  100         self_view='v1.ticket_discount_codes',
  101         self_view_kwargs={'id': '<id>'},
  102         related_view='v1.discount_code_list',
  103         related_view_kwargs={'ticket_id': '<id>'},
  104         schema='DiscountCodeSchemaTicket',
  105         many=True,
  106         type_='discount-code')
  107 
  108 
  109 class TicketSchema(TicketSchemaPublic):
  110     class Meta:
  111         type_ = 'ticket'
  112         self_view = 'v1.ticket_detail'
  113         self_view_kwargs = {'id': '<id>'}
  114         inflect = dasherize
  115 
  116     access_codes = Relationship(attribute='access_codes',
  117                                 self_view='v1.ticket_access_code',
  118                                 self_view_kwargs={'id': '<id>'},
  119                                 related_view='v1.access_code_list',
  120                                 related_view_kwargs={'ticket_id': '<id>'},
  121                                 schema='AccessCodeSchema',
  122                                 many=True,
  123                                 type_='access-code')
  124     attendees = Relationship(attribute='ticket_holders',
  125                              self_view='v1.ticket_attendees',
  126                              self_view_kwargs={'id': '<id>'},
  127                              related_view='v1.attendee_list_post',
  128                              related_view_kwargs={'ticket_id': '<id>'},
  129                              schema='AttendeeSchema',
  130                              many=True,
  131                              type_='attendee')
  132
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/app/api/schema/tickets.py b/app/api/schema/tickets.py
  --- a/app/api/schema/tickets.py
  +++ b/app/api/schema/tickets.py
  @@ -39,17 +39,17 @@
           if 'max_order' in data and 'min_order' in data:
               if data['max_order'] < data['min_order']:
                   raise UnprocessableEntity({'pointer': '/data/attributes/max-order'},
  -                                          "max-order should be greater than min-order")
  +                                          "max-order should be greater than or equal to min-order")
   
           if 'quantity' in data and 'min_order' in data:
               if data['quantity'] < data['min_order']:
                   raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
  -                                          "quantity should be greater than min-order")
  +                                          "quantity should be greater than or equal to min-order")
   
           if 'quantity' in data and 'max_order' in data:
               if data['quantity'] < data['max_order']:
                   raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},
  -                                          "quantity should be lesser than max-order")
  +                                          "quantity should be greater than or equal to max-order")
   
       @validates_schema(pass_original=True)
       def validate_discount_code(self, data, original_data):
  
verification_info: {"golden_diff": "diff --git a/app/api/schema/tickets.py b/app/api/schema/tickets.py\n--- a/app/api/schema/tickets.py\n+++ b/app/api/schema/tickets.py\n@@ -39,17 +39,17 @@\n         if 'max_order' in data and 'min_order' in data:\n             if data['max_order'] < data['min_order']:\n                 raise UnprocessableEntity({'pointer': '/data/attributes/max-order'},\n-                                          \"max-order should be greater than min-order\")\n+                                          \"max-order should be greater than or equal to min-order\")\n \n         if 'quantity' in data and 'min_order' in data:\n             if data['quantity'] < data['min_order']:\n                 raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\n-                                          \"quantity should be greater than min-order\")\n+                                          \"quantity should be greater than or equal to min-order\")\n \n         if 'quantity' in data and 'max_order' in data:\n             if data['quantity'] < data['max_order']:\n                 raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\n-                                          \"quantity should be lesser than max-order\")\n+                                          \"quantity should be greater than or equal to max-order\")\n \n     @validates_schema(pass_original=True)\n     def validate_discount_code(self, data, original_data):\n", "issue": "Correct exception for quantity < max order in tickets schema\n**Describe the bug**\r\n<!-- A clear and concise description of what the bug is. -->\r\nValidation check message for quantity to be more than max-order needs to be corrected.\r\n\r\n**To Reproduce**\r\nA validation check for quantity and max-order is:\r\n```\r\n        if 'quantity' in data and 'max_order' in data:\r\n            if data['quantity'] < data['max_order']:\r\n                raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\r\n                                          \"quantity should be lesser than max-order\")\r\n```\r\n\r\n**Expected behavior**\r\n<!-- A clear and concise description of what you expected to happen. -->\r\nThe message should be: \"quantity should not be lesser than max-order\".\n", "before_files": [{"content": "from marshmallow import validates_schema\nfrom marshmallow_jsonapi import fields\nfrom marshmallow_jsonapi.flask import Relationship\nfrom sqlalchemy.orm.exc import NoResultFound\n\nfrom app.api.helpers.exceptions import UnprocessableEntity\nfrom app.api.helpers.utilities import dasherize\nfrom app.api.schema.base import SoftDeletionSchema\nfrom app.models.discount_code import DiscountCode\nfrom app.models.ticket import Ticket\nfrom utils.common import use_defaults\n\n\n@use_defaults()\nclass TicketSchemaPublic(SoftDeletionSchema):\n    class Meta:\n        type_ = 'ticket'\n        self_view = 'v1.ticket_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    @validates_schema(pass_original=True)\n    def validate_date(self, data, original_data):\n        if 'id' in original_data['data']:\n            ticket = Ticket.query.filter_by(id=original_data['data']['id']).one()\n\n            if 'sales_starts_at' not in data:\n                data['sales_starts_at'] = ticket.sales_starts_at\n\n            if 'sales_ends_at' not in data:\n                data['sales_ends_at'] = ticket.sales_ends_at\n\n        if data['sales_starts_at'] >= data['sales_ends_at']:\n            raise UnprocessableEntity({'pointer': '/data/attributes/sales-ends-at'},\n                                      \"sales-ends-at should be after sales-starts-at\")\n\n    @validates_schema\n    def validate_quantity(self, data):\n        if 'max_order' in data and 'min_order' in data:\n            if data['max_order'] < data['min_order']:\n                raise UnprocessableEntity({'pointer': '/data/attributes/max-order'},\n                                          \"max-order should be greater than min-order\")\n\n        if 'quantity' in data and 'min_order' in data:\n            if data['quantity'] < data['min_order']:\n                raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\n                                          \"quantity should be greater than min-order\")\n\n        if 'quantity' in data and 'max_order' in data:\n            if data['quantity'] < data['max_order']:\n                raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\n                                          \"quantity should be lesser than max-order\")\n\n    @validates_schema(pass_original=True)\n    def validate_discount_code(self, data, original_data):\n        if 'relationships' in original_data and 'discount-codes' in original_data['data']['relationships']:\n            discount_codes = original_data['data']['relationships']['discount-codes']\n            for code in discount_codes['data']:\n                try:\n                    DiscountCode.query.filter_by(id=code['id']).one()\n                except NoResultFound:\n                    raise UnprocessableEntity(\n                        {'pointer': '/data/relationships/discount-codes'}, \"Discount code does not exist\")\n\n    id = fields.Str(dump_only=True)\n    name = fields.Str(required=True)\n    description = fields.Str(allow_none=True)\n    type = fields.Str(required=True)\n    price = fields.Float(validate=lambda n: n >= 0, allow_none=True)\n    quantity = fields.Integer(validate=lambda n: n >= 0, allow_none=True)\n    is_description_visible = fields.Boolean(default=False)\n    position = fields.Integer(allow_none=True)\n    is_fee_absorbed = fields.Boolean()\n    sales_starts_at = fields.DateTime(required=True)\n    sales_ends_at = fields.DateTime(required=True)\n    is_hidden = fields.Boolean(default=False)\n    min_order = fields.Integer(validate=lambda n: n >= 0, allow_none=True)\n    max_order = fields.Integer(validate=lambda n: n >= 0, allow_none=True)\n    is_checkin_restricted = fields.Boolean(default=True)\n    auto_checkin_enabled = fields.Boolean(default=False)\n    event = Relationship(attribute='event',\n                         self_view='v1.ticket_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'ticket_id': '<id>'},\n                         schema='EventSchemaPublic',\n                         type_='event')\n\n    ticket_tags = Relationship(attribute='tags',\n                               self_view='v1.ticket_ticket_tag',\n                               self_view_kwargs={'id': '<id>'},\n                               related_view='v1.ticket_tag_list',\n                               related_view_kwargs={'ticket_id': '<id>'},\n                               schema='TicketTagSchema',\n                               many=True,\n                               type_='ticket-tag')\n\n    discount_codes = Relationship(\n        attribute='discount_codes',\n        self_view='v1.ticket_discount_codes',\n        self_view_kwargs={'id': '<id>'},\n        related_view='v1.discount_code_list',\n        related_view_kwargs={'ticket_id': '<id>'},\n        schema='DiscountCodeSchemaTicket',\n        many=True,\n        type_='discount-code')\n\n\nclass TicketSchema(TicketSchemaPublic):\n    class Meta:\n        type_ = 'ticket'\n        self_view = 'v1.ticket_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    access_codes = Relationship(attribute='access_codes',\n                                self_view='v1.ticket_access_code',\n                                self_view_kwargs={'id': '<id>'},\n                                related_view='v1.access_code_list',\n                                related_view_kwargs={'ticket_id': '<id>'},\n                                schema='AccessCodeSchema',\n                                many=True,\n                                type_='access-code')\n    attendees = Relationship(attribute='ticket_holders',\n                             self_view='v1.ticket_attendees',\n                             self_view_kwargs={'id': '<id>'},\n                             related_view='v1.attendee_list_post',\n                             related_view_kwargs={'ticket_id': '<id>'},\n                             schema='AttendeeSchema',\n                             many=True,\n                             type_='attendee')\n", "path": "app/api/schema/tickets.py"}], "after_files": [{"content": "from marshmallow import validates_schema\nfrom marshmallow_jsonapi import fields\nfrom marshmallow_jsonapi.flask import Relationship\nfrom sqlalchemy.orm.exc import NoResultFound\n\nfrom app.api.helpers.exceptions import UnprocessableEntity\nfrom app.api.helpers.utilities import dasherize\nfrom app.api.schema.base import SoftDeletionSchema\nfrom app.models.discount_code import DiscountCode\nfrom app.models.ticket import Ticket\nfrom utils.common import use_defaults\n\n\n@use_defaults()\nclass TicketSchemaPublic(SoftDeletionSchema):\n    class Meta:\n        type_ = 'ticket'\n        self_view = 'v1.ticket_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    @validates_schema(pass_original=True)\n    def validate_date(self, data, original_data):\n        if 'id' in original_data['data']:\n            ticket = Ticket.query.filter_by(id=original_data['data']['id']).one()\n\n            if 'sales_starts_at' not in data:\n                data['sales_starts_at'] = ticket.sales_starts_at\n\n            if 'sales_ends_at' not in data:\n                data['sales_ends_at'] = ticket.sales_ends_at\n\n        if data['sales_starts_at'] >= data['sales_ends_at']:\n            raise UnprocessableEntity({'pointer': '/data/attributes/sales-ends-at'},\n                                      \"sales-ends-at should be after sales-starts-at\")\n\n    @validates_schema\n    def validate_quantity(self, data):\n        if 'max_order' in data and 'min_order' in data:\n            if data['max_order'] < data['min_order']:\n                raise UnprocessableEntity({'pointer': '/data/attributes/max-order'},\n                                          \"max-order should be greater than or equal to min-order\")\n\n        if 'quantity' in data and 'min_order' in data:\n            if data['quantity'] < data['min_order']:\n                raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\n                                          \"quantity should be greater than or equal to min-order\")\n\n        if 'quantity' in data and 'max_order' in data:\n            if data['quantity'] < data['max_order']:\n                raise UnprocessableEntity({'pointer': '/data/attributes/quantity'},\n                                          \"quantity should be greater than or equal to max-order\")\n\n    @validates_schema(pass_original=True)\n    def validate_discount_code(self, data, original_data):\n        if 'relationships' in original_data and 'discount-codes' in original_data['data']['relationships']:\n            discount_codes = original_data['data']['relationships']['discount-codes']\n            for code in discount_codes['data']:\n                try:\n                    DiscountCode.query.filter_by(id=code['id']).one()\n                except NoResultFound:\n                    raise UnprocessableEntity(\n                        {'pointer': '/data/relationships/discount-codes'}, \"Discount code does not exist\")\n\n    id = fields.Str(dump_only=True)\n    name = fields.Str(required=True)\n    description = fields.Str(allow_none=True)\n    type = fields.Str(required=True)\n    price = fields.Float(validate=lambda n: n >= 0, allow_none=True)\n    quantity = fields.Integer(validate=lambda n: n >= 0, allow_none=True)\n    is_description_visible = fields.Boolean(default=False)\n    position = fields.Integer(allow_none=True)\n    is_fee_absorbed = fields.Boolean()\n    sales_starts_at = fields.DateTime(required=True)\n    sales_ends_at = fields.DateTime(required=True)\n    is_hidden = fields.Boolean(default=False)\n    min_order = fields.Integer(validate=lambda n: n >= 0, allow_none=True)\n    max_order = fields.Integer(validate=lambda n: n >= 0, allow_none=True)\n    is_checkin_restricted = fields.Boolean(default=True)\n    auto_checkin_enabled = fields.Boolean(default=False)\n    event = Relationship(attribute='event',\n                         self_view='v1.ticket_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'ticket_id': '<id>'},\n                         schema='EventSchemaPublic',\n                         type_='event')\n\n    ticket_tags = Relationship(attribute='tags',\n                               self_view='v1.ticket_ticket_tag',\n                               self_view_kwargs={'id': '<id>'},\n                               related_view='v1.ticket_tag_list',\n                               related_view_kwargs={'ticket_id': '<id>'},\n                               schema='TicketTagSchema',\n                               many=True,\n                               type_='ticket-tag')\n\n    discount_codes = Relationship(\n        attribute='discount_codes',\n        self_view='v1.ticket_discount_codes',\n        self_view_kwargs={'id': '<id>'},\n        related_view='v1.discount_code_list',\n        related_view_kwargs={'ticket_id': '<id>'},\n        schema='DiscountCodeSchemaTicket',\n        many=True,\n        type_='discount-code')\n\n\nclass TicketSchema(TicketSchemaPublic):\n    class Meta:\n        type_ = 'ticket'\n        self_view = 'v1.ticket_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    access_codes = Relationship(attribute='access_codes',\n                                self_view='v1.ticket_access_code',\n                                self_view_kwargs={'id': '<id>'},\n                                related_view='v1.access_code_list',\n                                related_view_kwargs={'ticket_id': '<id>'},\n                                schema='AccessCodeSchema',\n                                many=True,\n                                type_='access-code')\n    attendees = Relationship(attribute='ticket_holders',\n                             self_view='v1.ticket_attendees',\n                             self_view_kwargs={'id': '<id>'},\n                             related_view='v1.attendee_list_post',\n                             related_view_kwargs={'ticket_id': '<id>'},\n                             schema='AttendeeSchema',\n                             many=True,\n                             type_='attendee')\n", "path": "app/api/schema/tickets.py"}]}