Created
May 3, 2011 17:22
-
-
Save bardusco/953758 to your computer and use it in GitHub Desktop.
calculo de scores
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
# Recebe um dicionario de questões/notas | |
# e retorna outro dicionario com questoes/escala de graduação. | |
def question_grade(list): | |
takeaction = { | |
# Server | |
'objetos': [8, 8, 8, 9, 9, 10], | |
'arquitetura': [8, 8, 9, 9, 10, 11], | |
'scm': [8, 8, 8, 9, 10, 11], | |
'oneclick': [8, 8, 8, 9, 10, 11], | |
'ci': [8, 8, 8, 9, 9, 10], | |
'bugs': [8, 8, 8, 9, 10, 11], | |
'padroes': [8, 8, 8, 9, 10, 11], | |
'fases': [8, 8, 8, 9, 10, 11], | |
'agilidade': [8, 8, 8, 9, 10, 11], | |
'db': [8, 8, 9, 9, 10, 11], | |
### as linguagens nao contam para o score ### | |
# 'java': [8, 8, 8, 9, 10, 11], | |
# 'python': [8, 8, 8, 9, 10, 11], | |
# 'ruby': [8, 8, 8, 9, 10, 11], | |
# 'php': [8, 8, 8, 9, 10, 11], | |
# 'perl': [8, 8, 8, 9, 10, 11], | |
#Qualidade | |
'teoria_qualidade': [8, 8, 8, 9, 9, 10], | |
'automacao_qualidade': [8, 8, 8, 9, 10, 11], | |
'carga': [8, 8, 8, 9, 10, 11], | |
'interface': [8, 8, 8, 9, 10, 11], | |
#Client | |
'cross_browser': [8, 8, 8, 8, 9, 9], | |
'web_standards': [8, 8, 8, 9, 9, 10], | |
'usabilidade': [8, 8, 8, 9, 9, 10], | |
'performance': [8, 8, 8, 9, 9, 10], | |
'javascript': [8, 8, 8, 9, 9, 10], | |
'otimizacao': [8, 8, 8, 9, 9, 10], | |
# 'outras_midias': [8, 8, 8, 9, 9, 10], | |
# 'flash': [8, 8, 8, 9, 9, 10], | |
# 'flex': [8, 8, 8, 9, 9, 10], | |
'eventos': [8, 8, 8, 9, 9, 10], | |
#Comportamental | |
'negocios': [8, 8, 8, 9, 10, 11], | |
'colaboracao': [8, 8, 8, 9, 10, 11], | |
'compromisso': [8, 8, 8, 9, 10, 11], | |
'lideranca': [8, 8, 8, 9, 10, 11], | |
'auto_desenv': [8, 8, 8, 9, 10, 11], | |
'inovacao': [8, 8, 8, 9, 10, 11], | |
'multi_disciplina': [8, 8, 8, 9, 10, 11], | |
#infra | |
'redes': [8, 8, 8, 9, 10, 11], | |
'protocolos': [8, 8, 8, 9, 10, 11], | |
'so': [8, 8, 8, 9, 10, 11], | |
'virtualizacao': [8, 8, 8, 9, 9, 10], | |
'monitoracao': [8, 8, 8, 9, 9, 10], | |
'app_server': [8, 8, 8, 9, 9, 10], | |
'automacao': [8, 8, 8, 9, 10, 11], | |
} | |
grade = {} | |
for key,value in list.iteritems(): | |
if key not in ('flex','flash','outras_midias','java','python','ruby','php','perl'): | |
if value is not None: | |
grade[key] = takeaction.get(key)[int(round(value))] | |
return grade | |
# dada a lista de scores, retorna o porcentual de cada score | |
# na forma(eg.): {'9': 0.80000000000000004, '8': 1.0, '11': 0, '10': 0.0} | |
def score(specialty,list): | |
score = { | |
'infra': { '8': 7, '9': 7, '10': 7, '11': 4 }, | |
'behavioral': { '8': 7, '9': 7, '10': 7, '11': 7 }, | |
'client': { '8': 7, '9': 7, '10': 6, '11': 0 }, | |
'quality': { '8': 4, '9': 4, '10': 4, '11': 3 }, | |
'server': { '8': 10, '9': 10, '10': 10, '11': 8 }, | |
} | |
S = [0,0,0,0,0,0,0,0,0,0,0,0,0] | |
N = { '8': 0, '9': 0, '10': 0, '11': 0 } | |
for i in list.values(): | |
if i >= 8: S[8] = S[8]+1 | |
if i >= 9: S[9] = S[9]+1 | |
if i >= 10: S[10] = S[10]+1 | |
if i >= 11: S[11] = S[11]+1 | |
for i in [8,9,10,11]: | |
total = float(score.get(specialty).get(str(i))) | |
if total>0: N[str(i)]=float(float(S[i])/total) | |
return N |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment