This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clientes_para_inativar | |
Clientes.all.select do |cliente| | |
cliente.ultima_compra >1.month.ago && cliente.ativo? | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def inativar_clientes | |
inativar clientes = | |
Clientes.all.select do |cliente| | |
cliente.ultima_compra > 1.month.ago && cliente.ativo? | |
end | |
clientes_para_inativar.each(&:deactivate) | |
AvisarClientePorWpp.inativados(inativar_clientes) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def valor_final(valor_base,porcentagem) | |
if porcentagem.nil?|| | |
porcentagem <10 | |
valor_base | |
else | |
valor_base *(porcentagem/100) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it 'calcula o valor final com 10%' | |
expect (valor_final(100,10). to eq (110) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def valor_final (valor_base,porcentagem) | |
valor (valor_base,porcentagem) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it 'valor com 10%' do | |
expect (valor(100,10)). to eq(110) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def valor (valor_base,porcentagem) | |
if porcentagem.nil? || porcentagem <10 | |
valor_base | |
else | |
valor_base * (porcentagem/100) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Pokedex</title> | |
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap.css') }}"> | |
</head> | |
<body> | |
<div class="container"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "template.html" %} | |
{% block conteudo %} | |
<form action="{{ url_for('criar') }}" method="post"> | |
<fieldset> | |
<div class="form-group"> | |
<label for="nome">Nome</label> | |
<input type="text" id="nome" name="nome" class="form-control"> | |
</div> | |
<div class="form-group"> | |
<label for="categoria">Espécie</label> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Pokedex</title> | |
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap.css') }}"> | |
</head> | |
<body> | |
<div class="container"> |