Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Guia1/src/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added Guia1/src/__pycache__/main.cpython-36.pyc
Binary file not shown.
Binary file added Guia1/src/config/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file added Guia1/src/config/__pycache__/settings.cpython-36.pyc
Binary file not shown.
Binary file added Guia1/src/models/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
45 changes: 36 additions & 9 deletions Guia1/src/repositories/record_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
]
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
Binary file not shown.
Binary file not shown.
Binary file added Guia1/src/utils/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file added Guia1/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Guia1/tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ===")
Expand Down Expand Up @@ -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

Expand Down
Binary file added Guia2/src/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 28 additions & 2 deletions Guia2/src/folha_pagamento/desenvolvedor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,31 @@

# Desenvolva a classe Desenvolvedor aqui.

class Desenvolvedor:
pass
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
21 changes: 19 additions & 2 deletions Guia2/src/folha_pagamento/estagiario.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,22 @@

# Desenvolva a classe Estagiario aqui.

class Estagiario:
pass
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
28 changes: 26 additions & 2 deletions Guia2/src/folha_pagamento/gerente.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,29 @@

# Desenvolva a classe Gerente aqui.

class Gerente:
pass
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
Binary file added Guia2/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.