-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from gabrielfava/homologacao
Homologacao
- Loading branch information
Showing
11 changed files
with
252 additions
and
36 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,4 +99,4 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
Modulos/Times/select_team_mysql.py | ||
Modulos/Times/database_conf.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ASAPY | ||
import requests | ||
__URL_GLOBAL = "https://www.urionlinejudge.com.br"; | ||
|
||
def printme(pagina): | ||
body = getCorpo(__URL_GLOBAL+"/judge/pt/problems/view/"+pagina); | ||
iInicio = find_str(body, "<iframe"); | ||
pos = (body[iInicio:]); | ||
iFim = find_str(pos, ">")+1; | ||
tupla = pos[:iFim]; | ||
page2 = getAttr(tupla,"src"); | ||
|
||
bodyframe = getCorpo(__URL_GLOBAL+page2); | ||
print(bodyframe); | ||
|
||
return; | ||
|
||
|
||
def find_str(s, char): | ||
index = 0 | ||
if char in s: | ||
c = char[0] | ||
for ch in s: | ||
if ch == c: | ||
if s[index:index+len(char)] == char: | ||
return index | ||
index += 1 | ||
return -1 | ||
|
||
#TODO - TRATAR EQUIVALENCIA DE SINTAXE ! | ||
def getAttr(tupla, atributo): | ||
tamanhoAtr = len(atributo)+2; #ja apaga atributo=" | ||
inicioAtr = find_str(tupla, atributo)+tamanhoAtr; | ||
if inicioAtr == -1: | ||
return "ERRO" | ||
fimAttr = find_str(tupla[inicioAtr:], '"'); | ||
return tupla[inicioAtr:inicioAtr+fimAttr]; | ||
|
||
def getCorpo(req): | ||
page = requests.get(req); | ||
return str(page.content); | ||
|
||
|
||
printme("2166") | ||
|
||
|
||
#print("titulo => URI Online Judge - Problema 2166 - Raiz Quadrada de 2") | ||
#print("autor => M.C. Pinto, UNILA") | ||
#print("probm => ma das formas de calcular a raiz quadrada de um n\xc3\xbamero natural") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import requests | ||
printme(2661) | ||
# retorna corpo da pagina | ||
def printme(id): | ||
page = requests.get("https://www.urionlinejudge.com.br/judge/pt/problems/view/"+id); | ||
print(page.content); | ||
return; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
mysql = { | ||
'user': 'scott', | ||
'password': 'password', | ||
'host': '127.0.0.1', | ||
'database': 'employees', | ||
'raise_on_warnings': True, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,65 @@ | ||
import string | ||
import random | ||
from mysql.connector import MySQLConnection, Error | ||
import database_conf as cfg | ||
import team | ||
|
||
__select_ALL = "SELECT team_number, team_site, team_name, password, team_short_name, enabled, type, multi_login, team_full_name FROM TEAMS" | ||
|
||
|
||
usuarios = ['Time1', 'Time2', 'Time3', 'Time4'] | ||
def select_teams(cursor): | ||
query = ("SELECT team_number, team_name, password from TEAMS") | ||
cursor.execute(query) | ||
return cursor | ||
|
||
# [user] | ||
# usernumber=900 | ||
# usersitenumber=1 | ||
# username=time1 | ||
# usertype=team | ||
# userenabled=t | ||
# usermultilogin=f | ||
# userfullname=[TIME 1]ASAP | ||
# userdesc=[TIME 1]ASAP | ||
# userpassword=20194143 | ||
def update_passwords(cnx, cursor): | ||
for(team_number, team_name, password) in cursor: | ||
if(not password): | ||
new_pass = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(6)) | ||
query = """UPDATE TEAMS | ||
SET password=%s | ||
WHERE team_number=%s""" | ||
data = (new_pass, team_number) | ||
|
||
print('[user]') | ||
for usuario in usuarios: | ||
print('userna') | ||
print(usuario + ' ' + ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(10))) | ||
try: | ||
cursor.execute(query,data) | ||
except Error as error: | ||
print(error) | ||
|
||
cnx.commit() | ||
|
||
|
||
def generate_file(cursor): | ||
cursor.execute(__select_ALL) | ||
f = open("import.txt", 'w') | ||
f.write("[user]") | ||
first_team = True | ||
for(team_number, team_site, team_name, password, team_short_name, enabled, type, multi_login, team_full_name) in cursor: | ||
if(first_team): | ||
f.write('\n') | ||
first_team = False | ||
else: | ||
f.write('\n\n') | ||
f.write('usernumber=' + str(team_number)) | ||
f.write('\nusersitenumber=' + team_site) | ||
f.write('\nusername=' + team_short_name) | ||
f.write('\nusertype=' + type) | ||
f.write('\nuserenabled=' + enabled) | ||
f.write('\nusermultilogin=' + multi_login) | ||
f.write('\nuserfullname=' + team_full_name) | ||
f.write('\nuserdesc=' + team_full_name) | ||
f.write('\nuserpassword=' + str(password)) | ||
f.close() | ||
|
||
|
||
def main(): | ||
cnx = MySQLConnection(**cfg.mysql) | ||
cursor = cnx.cursor() | ||
select_teams(cursor) | ||
update_passwords(cnx, cursor) | ||
generate_file(cursor) | ||
cursor.close() | ||
cnx.close() | ||
|
||
if __name__ == "__main__": | ||
main() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[user] | ||
usernumber=900 | ||
usersitenumber=1 | ||
username=team1 | ||
usertype=team | ||
userenabled=t | ||
usermultilogin=f | ||
userfullname=[Team 1] ASAP | ||
userdesc=[Team 1] ASAP | ||
userpassword=5EUQDV | ||
|
||
usernumber=901 | ||
usersitenumber=1 | ||
username=team2 | ||
usertype=team | ||
userenabled=t | ||
usermultilogin=f | ||
userfullname=[Team 2] Sudocode | ||
userdesc=[Team 2] Sudocode | ||
userpassword=ZHODQV | ||
|
||
usernumber=902 | ||
usersitenumber=1 | ||
username=team3 | ||
usertype=team | ||
userenabled=t | ||
usermultilogin=f | ||
userfullname=[Team 3] JAVAIScript | ||
userdesc=[Team 3] JAVAIScript | ||
userpassword=FV5Y78 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import mysql.connector | ||
import database_conf as cfg | ||
|
||
cnx = mysql.connector.connect(**cfg.mysql) | ||
|
||
cursor = cnx.cursor() | ||
query = ("SELECT team_number, team_name FROM teams") | ||
|
||
cursor.execute(query) | ||
|
||
for(team_number, team_name) in cursor: | ||
print("{} -> {}".format(team_number, team_name)) | ||
|
||
cursor.close() | ||
cnx.close() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#team.py | ||
class Team(object): | ||
"""docstring for Team""" | ||
# [user] | ||
# usernumber=900 | ||
# usersitenumber=1 | ||
# username=time1 | ||
# usertype=team | ||
# userenabled=t | ||
# usermultilogin=f | ||
# userfullname=[TIME 1]ASAP | ||
# userdesc=[TIME 1]ASAP | ||
# userpassword=20194143 | ||
|
||
seq = 0 | ||
objects = [] | ||
|
||
def __init__(team_number, team_site, team_name, enabled, type, multi_login, team_full_name, password ): | ||
super(Team, self).__init__() | ||
self.team_number = team_number | ||
self.team_site = team_site | ||
self.team_name = team_name | ||
self.enabled = enabled | ||
self.type = type | ||
self.multi_login = multi_login | ||
self.team_full_name = team_full_name | ||
self.password = password | ||
|
||
def save(self): | ||
self.__class__.seq += 1 | ||
self.team_number = self.__class__.seq | ||
self.__class__.objects.append(self) | ||
|
||
@classmethod | ||
def all(cls): | ||
return cls.objects |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
# asaPY | ||
# asaPY - Gestão para Maratonas de Programação | ||
Autores: | ||
* [Gabriel Fava](https://github.com/gabrielfava) | ||
* [João Paulo Mondoni](https://github.com/jpmondoni) | ||
|
||
## O que é? | ||
O **asaPY** foi idealizado para suprir necessidades de faculdades que queiram gerenciar suas equipes em competições de programação. Este software visa entregar um stack de soluções para o coordenador do projeto de programação competitiva para que o mesmo possa gastar o seu tempo e energia com aquilo que é realmente necessário para alcançar os objetivos de uma maratona: **a preparação da equipe**. | ||
|
||
O **asaPY** é completamente open-source e livre para uso, totalmente mantido pela comunidade e pelos desenvolvedores como um projeto paralelo. O projeto é executado em um ambiente web, com uso de banco de dados MySQL. | ||
|
||
## Funcionalidades | ||
* Cadastro e gestão de equipes | ||
* Cadastro e gestão de competições internas | ||
* Asap Analytics | ||
* Gestão de resultados | ||
* Integrações com o BOCA | ||
* Geração de pack de exercícios automaticamente | ||
* Geração de senhas | ||
* Gestão de exercícios através de scraping | ||
|
||
## Status | ||
O projeto teve início ao desenvolvimento no dia 24 de fevereiro de 2018. As etapas do desenvolvimento serão: | ||
* Desenvolver funcionalidades em back-end | ||
* Criação do front-end | ||
* Integração framework Flask | ||
* Release da versão beta. | ||
|
||
## Releases | ||
Confira os releases no branch `master` do projeto, em [releases](https://github.com/gabrielfava/asapy/releases). | ||
|
||
## Contato | ||
* Quer contribuir com o projeto? Tem alguma sugestão? | ||
|
||
Nos mande um e-mail em `jp ponto mondoni arroba gmail ponto com` ou `gabrielfavasouza arroba gmail ponto com` | ||
|
||
* Bugs, erros ou suporte | ||
|
||
Crie um novo `issue` em nosso repositório: [Issues](https://github.com/gabrielfava/asapy/issues). |