diff --git a/Guia1/src/__pycache__/__init__.cpython-36.pyc b/Guia1/src/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..031a26f Binary files /dev/null and b/Guia1/src/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/src/__pycache__/main.cpython-36.pyc b/Guia1/src/__pycache__/main.cpython-36.pyc new file mode 100644 index 0000000..6fa635c Binary files /dev/null and b/Guia1/src/__pycache__/main.cpython-36.pyc differ diff --git a/Guia1/src/config/__pycache__/__init__.cpython-36.pyc b/Guia1/src/config/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..44414ab Binary files /dev/null and b/Guia1/src/config/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/src/config/__pycache__/settings.cpython-36.pyc b/Guia1/src/config/__pycache__/settings.cpython-36.pyc new file mode 100644 index 0000000..580b855 Binary files /dev/null and b/Guia1/src/config/__pycache__/settings.cpython-36.pyc differ diff --git a/Guia1/src/models/__pycache__/__init__.cpython-36.pyc b/Guia1/src/models/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..075b4a7 Binary files /dev/null and b/Guia1/src/models/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/src/models/__pycache__/record.cpython-36.pyc b/Guia1/src/models/__pycache__/record.cpython-36.pyc new file mode 100644 index 0000000..1efb2dc Binary files /dev/null and b/Guia1/src/models/__pycache__/record.cpython-36.pyc differ diff --git a/Guia1/src/repositories/__pycache__/__init__.cpython-36.pyc b/Guia1/src/repositories/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..c87212e Binary files /dev/null and b/Guia1/src/repositories/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/src/repositories/__pycache__/abstract_repository.cpython-36.pyc b/Guia1/src/repositories/__pycache__/abstract_repository.cpython-36.pyc new file mode 100644 index 0000000..9b93e02 Binary files /dev/null and b/Guia1/src/repositories/__pycache__/abstract_repository.cpython-36.pyc differ diff --git a/Guia1/src/repositories/__pycache__/record_repository.cpython-36.pyc b/Guia1/src/repositories/__pycache__/record_repository.cpython-36.pyc new file mode 100644 index 0000000..e8448d8 Binary files /dev/null and b/Guia1/src/repositories/__pycache__/record_repository.cpython-36.pyc differ diff --git a/Guia1/src/repositories/record_repository.py b/Guia1/src/repositories/record_repository.py index bded279..b436db7 100644 --- a/Guia1/src/repositories/record_repository.py +++ b/Guia1/src/repositories/record_repository.py @@ -10,15 +10,42 @@ def __init__(self, file_path: str): def load_all(self): data = FileLoader.load_csv(self._file_path) - self._records = [ - Record(int(row["id"]), row["name"], row["address"]) - for row in data - ] + records = [] + + for row in data: + try: + raw_id = row.get("id", "") + name = row.get("name", "") + address = row.get("address", "") + + if raw_id == "" or name.strip() == "" or address.strip() == "": + print(f"Registro inválido ignorado: {row}") + continue + + record_id = int(raw_id) + + if record_id <= 0: + print(f"Registro inválido ignorado: {row}") + continue + + records.append(Record(record_id, name, address)) + + except (ValueError, TypeError): + print(f"Registro inválido ignorado: {row}") + continue + + self._records = records return self._records def search(self, term: str): - term = term.lower() - return [ - r for r in self._records - if term in r.name.lower() or term in r.address.lower() - ] \ No newline at end of file + terms = term.lower().split() + result = [] + + for r in self._records: + name = r.name.lower() + address = r.address.lower() + + if all(t in name or t in address for t in terms): + result.append(r) + + return result \ No newline at end of file diff --git a/Guia1/src/services/__pycache__/__init__.cpython-36.pyc b/Guia1/src/services/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..86df599 Binary files /dev/null and b/Guia1/src/services/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/src/services/__pycache__/record_service.cpython-36.pyc b/Guia1/src/services/__pycache__/record_service.cpython-36.pyc new file mode 100644 index 0000000..74cd745 Binary files /dev/null and b/Guia1/src/services/__pycache__/record_service.cpython-36.pyc differ diff --git a/Guia1/src/utils/__pycache__/__init__.cpython-36.pyc b/Guia1/src/utils/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..2966b6b Binary files /dev/null and b/Guia1/src/utils/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/src/utils/__pycache__/file_loader.cpython-36.pyc b/Guia1/src/utils/__pycache__/file_loader.cpython-36.pyc new file mode 100644 index 0000000..9a0f7c3 Binary files /dev/null and b/Guia1/src/utils/__pycache__/file_loader.cpython-36.pyc differ diff --git a/Guia1/tests/__pycache__/__init__.cpython-36.pyc b/Guia1/tests/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..ccea81a Binary files /dev/null and b/Guia1/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia1/tests/__pycache__/test_runner.cpython-36.pyc b/Guia1/tests/__pycache__/test_runner.cpython-36.pyc new file mode 100644 index 0000000..29d3c59 Binary files /dev/null and b/Guia1/tests/__pycache__/test_runner.cpython-36.pyc differ diff --git a/Guia1/tests/test_runner.py b/Guia1/tests/test_runner.py index f8004a8..c9c2bdf 100644 --- a/Guia1/tests/test_runner.py +++ b/Guia1/tests/test_runner.py @@ -10,7 +10,7 @@ def __init__(self): base_dir = os.path.dirname(os.path.dirname(__file__)) self.test_file = os.path.join(base_dir, "data", "records_teste.csv") self.service = RecordService(self.test_file) - print(f"\n{calculate_file_hash(os.path.join(base_dir, "tests", "test_runner.py"))}") + print(f'\n{calculate_file_hash(os.path.join(base_dir, "tests", "test_runner.py"))}') def run(self): print("\n=== EXECUTANDO TESTES ===") @@ -61,7 +61,7 @@ def test_search_multiple_terms(self): for r in results: text = (r.name + " " + r.address).lower() - if "joao" not in text or "rua" not in text or "a" not in text: + if "joão" not in text or "rua" not in text or "a" not in text: print("FALHA: Resultado incorreto na busca") return diff --git a/Guia2/src/__pycache__/__init__.cpython-36.pyc b/Guia2/src/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..546ca2f Binary files /dev/null and b/Guia2/src/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/__init__.cpython-36.pyc b/Guia2/src/folha_pagamento/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..9b080f4 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/desenvolvedor.cpython-36.pyc b/Guia2/src/folha_pagamento/__pycache__/desenvolvedor.cpython-36.pyc new file mode 100644 index 0000000..0a24f92 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/desenvolvedor.cpython-36.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/estagiario.cpython-36.pyc b/Guia2/src/folha_pagamento/__pycache__/estagiario.cpython-36.pyc new file mode 100644 index 0000000..a8ed020 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/estagiario.cpython-36.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/funcionario.cpython-36.pyc b/Guia2/src/folha_pagamento/__pycache__/funcionario.cpython-36.pyc new file mode 100644 index 0000000..5f00145 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/funcionario.cpython-36.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/gerente.cpython-36.pyc b/Guia2/src/folha_pagamento/__pycache__/gerente.cpython-36.pyc new file mode 100644 index 0000000..44b396d Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/gerente.cpython-36.pyc differ diff --git a/Guia2/src/folha_pagamento/desenvolvedor.py b/Guia2/src/folha_pagamento/desenvolvedor.py index 5c5d3c9..1bd4cd6 100644 --- a/Guia2/src/folha_pagamento/desenvolvedor.py +++ b/Guia2/src/folha_pagamento/desenvolvedor.py @@ -2,5 +2,31 @@ # Desenvolva a classe Desenvolvedor aqui. -class Desenvolvedor: - pass \ No newline at end of file +class Desenvolvedor(Funcionario): + def __init__(self, nome: str, matricula: str, salario_base: float, linguagem, senioridade): + super().__init__(nome,matricula,salario_base) + self.linguagem = linguagem + self.senioridade = senioridade + + def calcular_bonus(self): + if self.senioridade.lower() == "junior": + return self.salario_base *0.05 + + if self.senioridade.lower() == "pleno": + return self.salario_base *0.10 + + if self.senioridade.lower() == "senior": + return self.salario_base *0.15 + + def calcular_descontos(self): + return self.salario_base *0.08 + + def calcular_adicionais(self): + if self.linguagem.lower() == "python": + return 500 + elif self.linguagem.lower() == "java": + return 400 + elif self.linguagem.lower() == "javascript": + return 350 + else: + return 200 \ No newline at end of file diff --git a/Guia2/src/folha_pagamento/estagiario.py b/Guia2/src/folha_pagamento/estagiario.py index d50a433..27dc712 100644 --- a/Guia2/src/folha_pagamento/estagiario.py +++ b/Guia2/src/folha_pagamento/estagiario.py @@ -2,5 +2,22 @@ # Desenvolva a classe Estagiario aqui. -class Estagiario: - pass \ No newline at end of file +class Estagiario(Funcionario): + def __init__(self, nome: str, matricula: str, salario_base: float, curso, carga_horaria, ): + super().__init__(nome,matricula,salario_base) + self.curso =curso + self. carga_horaria = carga_horaria + + def calcular_bonus(self): + return self.salario_base *0.03 + + def calcular_descontos(self): + return self.salario_base *0.02 + + def calcular_adicionais(self): + if self.carga_horaria <=20: + return 150 + if self.carga_horaria >20 and self.carga_horaria <=30: + return 250 + if self.carga_horaria >30: + return 350 \ No newline at end of file diff --git a/Guia2/src/folha_pagamento/gerente.py b/Guia2/src/folha_pagamento/gerente.py index 31819a1..993355f 100644 --- a/Guia2/src/folha_pagamento/gerente.py +++ b/Guia2/src/folha_pagamento/gerente.py @@ -2,5 +2,29 @@ # Desenvolva a classe Gerente aqui. -class Gerente: - pass \ No newline at end of file +class Gerente(Funcionario): + def __init__(self, nome: str, matricula: str, salario_base: float, setor, qtd_equipe): + super().__init__(nome,matricula,salario_base) + self.setor = setor + self.qtd_equipe = qtd_equipe + + + def calcular_bonus(self): + if self.qtd_equipe <=5: + return self.salario_base *0.10 + if self.qtd_equipe >= 6 and self.qtd_equipe <=10: + return self.salario_base *0.15 + if self.qtd_equipe >10: + return self.salario_base *0.20 + + def calcular_descontos(self): + return self.salario_base *0.12 + + def calcular_adicionais(self): + if self.qtd_equipe >10: + return 2000 + + elif self.qtd_equipe >5 and self.qtd_equipe <=10: + return 1000 + else: + return 500 \ No newline at end of file diff --git a/Guia2/tests/__pycache__/__init__.cpython-36.pyc b/Guia2/tests/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000..0398c4d Binary files /dev/null and b/Guia2/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/Guia2/tests/__pycache__/test_desenvolvedor.cpython-36-pytest-7.0.1.pyc b/Guia2/tests/__pycache__/test_desenvolvedor.cpython-36-pytest-7.0.1.pyc new file mode 100644 index 0000000..1d3f15e Binary files /dev/null and b/Guia2/tests/__pycache__/test_desenvolvedor.cpython-36-pytest-7.0.1.pyc differ diff --git a/Guia2/tests/__pycache__/test_estagiario.cpython-36-pytest-7.0.1.pyc b/Guia2/tests/__pycache__/test_estagiario.cpython-36-pytest-7.0.1.pyc new file mode 100644 index 0000000..77304e3 Binary files /dev/null and b/Guia2/tests/__pycache__/test_estagiario.cpython-36-pytest-7.0.1.pyc differ diff --git a/Guia2/tests/__pycache__/test_gerente.cpython-36-pytest-7.0.1.pyc b/Guia2/tests/__pycache__/test_gerente.cpython-36-pytest-7.0.1.pyc new file mode 100644 index 0000000..df67aab Binary files /dev/null and b/Guia2/tests/__pycache__/test_gerente.cpython-36-pytest-7.0.1.pyc differ