Пример #1
0
def get_available_ticket_list(city_from, city_to, date_departure, date_return):
    dohop_tickets_raw = dohop_script.get_available_flights(city_from, city_to, date_departure, date_return)
    kiwi_tickets_raw, kiwi_currency = kiwi_script.get_all_available_tickets_and_currency_code(city_from, city_to, date_departure, date_return)
    tickets_list = []
    for dohop_ticket_raw in dohop_tickets_raw:
        tickets_list.append(Ticket.DohopTicket(dohop_ticket_raw))

    for kiwi_ticket_raw in kiwi_tickets_raw:
        tickets_list.append(Ticket.KiwiTicket(kiwi_ticket_raw, kiwi_currency))
    return tickets_list
Пример #2
0
    def getTicket(self, ticket_id, project_id):
        if ticket_id not in self.tickets:
            # Find the current user
            url = "https://" + self.config[
                'domain'] + ".unfuddle.com/api/v1/projects/" + str(
                    project_id) + "/tickets/" + str(ticket_id) + ".json"
            headers = self.getAuthorizationHeaders()

            req = urllib.request.Request(url, None, headers)
            response = urllib.request.urlopen(req)
            payload = response.read()

            data = json.loads(payload.decode('UTF-8'))

            project = self.getProjectById(project_id)

            ticket_url = "https://" + self.config[
                'domain'] + ".unfuddle.com/a#/projects/" + str(
                    project_id) + "/tickets/by_number/" + str(data['number'])
            ticket = Ticket.Ticket(
                project['short_name'] + '-' + str(data['number']),
                data['summary'], ticket_url)
            self.tickets[ticket_id] = ticket

        return self.tickets[ticket_id]
Пример #3
0
def addTicket():

    newTicket = Ticket('', '', '')
    message = input('Introduce the ticket ID:\n')
    newTicket.setID(message)
    message2 = input('Introduce the ticket Description:\n')
    newTicket.setDescription(message2)
    message3 = input('Introduce the ticket Priority:\n')
    newTicket.setPriority(message3)
    TicketList.append(newTicket)
Пример #4
0
 def printSimplified(self):
     """Simplified ticket printer."""
     if self.orderTotal.getTotal() > 0:
         self.setTime()
         ticket = Ticket.Ticket(self.collector(), self, simplified=True)
         # if ticket.exec_():
         #     pass
         printer = Printer.Print()
         printer.Print(ticket, simplified=True)
         printer = None
         ticket.setParent(None)
Пример #5
0
def get_ticket(id):
    person = DB.get_user(id)
    code = get_code(person)
    FI = re.match("[а-яё]+ [а-яё]+", person[3], flags=re.I).group(0)
    add_message = vkMessage('Держите Ваш билет.\n\
                             Этот билет необходимо предъявить на стойке регистрации около аудитории, в которой будет проходить форум 1 марта.\n\
                             Распечатывать билет не обязательно, достаточно будет показать штрих-код на билете с телефона, и ваше присутствие будет зарегистрировано!'
                            )
    add_message.attachment = Ticket.get_ticket_attachment(id, FI, code)
    add_message.peer_id = add_message.user_id = id
    add_message.send()
    return code
Пример #6
0
 def printTicket(self, cancelled=False):
     """Simplified ticket printer."""
     if self.orderTotal.getTotal() > 0:
         self.setTime()
         ticket = Ticket.Ticket(self.collector(), self, cancelled=cancelled)
         # if ticket.exec_():
         #     pass
         printer = Printer.Print()
         printer.Print(ticket)
         printer = None
         ticket.setParent(None)
         db = Db()
         db.recordTicket(self.collector())
         self.parent.deleteSession(self, self.parent.sessionIndex(self))
def parseJSONintoTicketClass_singleTask(jsonData):
    task = jsonData['Task']
    executorsNames = []
    if task['ExecutorIds'] is not None:
        for id in task['ExecutorIds'].split(','):
            id = str.strip(id)
            executorsNames.append(getExecutorNameById(id))

    ticket = Ticket.Ticket(ticketId=task['Id'],
                           status=getStatusNameById(task['StatusId']),
                           title=task['Name'],
                           creatorName=task['Creator'],
                           creatorCompanyName=getCompanyNameByUserName(
                               task['Creator']),
                           creationDate=task['Created'],
                           description=task['Description'],
                           dueDate=task['Deadline'],
                           executors=executorsNames)
    return ticket
Пример #8
0
def createIndexOnTicketTransfers():
    #Create a null dictionary
    expertsToIncidents = {}

    #Read the input file
    with open('files/Transfer Time Intervals Converted.txt') as f:
        content = f.readlines()
    content.remove(content[0])
    #Parse the file and fill the dictionary
    for line in content:
        parts = line.split()
        if parts[7] == 'null':
            continue
        incidents = []
        if expertsToIncidents.has_key(parts[1]):
            incidents = expertsToIncidents.get(parts[1])
        t = Ticket.Ticket(line)
        incidents.append(t)
        expertsToIncidents[parts[1]] = incidents
    return expertsToIncidents
Пример #9
0
    def park_new_vehicle(self, vehicle, age):
        """
		Function to park the vehicle recieved from park function
		"""

        # Check if parking lot is full or have space
        if self.__is_full():
            try:
                slot = self.__get_next_available_slot()
                if slot:
                    slot.park_vehicle(vehicle)

                ticket = Ticket.Ticket(vehicle, slot, age)
                slot.generate_ticket(ticket)

                self.car_list.append(vehicle)

                print(
                    'Car with vehicle registration number "{}" has been parked at slot number {}'
                    .format(vehicle.get_reg_number(), slot.get_slot_number()))
            except Exception as e:
                print("Exception {} while parking vehicle".format(e))
        else:
            print("Sorry, parking lot is full.")
Пример #10
0
    def inicjalize_ticket(self):
        #tworzenie listy obiektow bilet
        nazwy = ["Normalny 20 min","Ulgowy 20 min","Normalny 40 min","Ulgowy 40 min","Normalny 60 min","Ulgowy 60 min"]
        cena = [1.70, 1.40, 2.20, 1.70, 2.80, 2.40]

        self.ticket = [Ticket(name=nazwy[x], prize=cena[x]) for x in range(6)]
Пример #11
0
 def setUp(self):
     self.ticket = Ticket()
     self.purchased_item = "4380500008685118"
Пример #12
0
class TicketTest(unittest.TestCase):
    def setUp(self):
        self.ticket = Ticket()
        self.purchased_item = "4380500008685118"

    def test01_total_of_newly_created_ticket_is_zero(self):
        self.assertEqual(self.ticket.total(), 0.0)

    def test02_newly_created_ticket_does_not_contain_items(self):
        self.assertFalse(self.ticket.contains_item(self.purchased_item, 1))

    def test03_can_add_item_to_ticket(self):
        self.ticket.add_item(self.purchased_item, 1, 50)

        self.assertTrue(self.ticket.contains_item(self.purchased_item, 1))
        self.assertEqual(self.ticket.total(), 50)

    def test04_can_add_multiple_items_to_ticket(self):
        another_purchased_item = "7680500008685529"

        self.ticket.add_item(self.purchased_item, 1, 50)
        self.ticket.add_item(another_purchased_item, 3, 10)

        self.assertTrue(self.ticket.contains_item(self.purchased_item, 1))
        self.assertTrue(self.ticket.contains_item(another_purchased_item, 3))
        self.assertEqual(self.ticket.total(), 80)

    def test05_item_that_was_not_purchased_is_not_in_ticket_with_other_items(
            self):
        not_purchased_item = "4380500008685118"

        self.ticket.add_item(not_purchased_item, 1, 50)

        self.assertFalse(self.ticket.contains_item(not_purchased_item, 3))