Exemplo n.º 1
0
def computeRating(subFolder, sectionId, G) :
    fileName = os.path.join(subFolder, 'Tex', 'table'+sectionId+'.tex')
    print '\nBuilding table ', fileName
    names = extractNames(subFolder)

    # TeX version
    f = open(fileName,'w')
    
    res = []
    for id in G.nodes() :
        fullName = names.get(id,['',''])[0]
        position = names.get(id,['',''])[1]
        score = G.in_degree(id)
        res.append([id,fullName,position,score])

    res.sort(cmp = cmp)

    for t in res :
        resLine = t[0] + ' & ' + t[1] + ' & ' + t[2] + ' & ' + str(t[3]) + '\\\\ \n'
        f.write(resLine)
    f.close()

    resHtml = ''
    for t in res :
        resLineHtml = '<tr><td class="right">'+t[0]+'.&nbsp;</td><td>'+t[1]+'</td><td>'+t[2]+'</td><td class="number">'+str(t[3])+'</td></tr>'
        resHtml = resHtml + resLineHtml 
    templateFileName = os.path.join(subFolder,'Report_template.html')
    BuildTexts.replaceInFile(templateFileName,'rating'+sectionId,resHtml)
Exemplo n.º 2
0
def addSizeComments(subFolder, numOfNodes) :
    
    if numOfNodes <= 7 :
        res = '\socioSizeTextA'
    elif numOfNodes <= 11 :
        res = '\socioSizeTextB'
    elif numOfNodes <= 16 :
        res = '\socioSizeTextC'
    elif numOfNodes <= 21 :
        res = '\socioSizeTextD'
    else :
        res = '\socioSizeTextE'

    fileName = os.path.join(subFolder, 'Tex', 'commands.tex')
    BuildTexts.replaceInFile(fileName, res, '\socioSizeComment')
Exemplo n.º 3
0
def addNamesListToHtml(subFolder):

    names = extractNames(subFolder)
    
    res = ''

    for id in range(len(names)) :
        number = str(id+1)
        fullName = names[number][0]
        position = names[number][1]
        resLine = '<tr><td>&nbsp;'+number+'.</td><td>'+fullName+'</td><td>'+position+'</td></tr>'
        res = res + resLine

    templateFileName = os.path.join(subFolder,'Report_template.html')
    BuildTexts.replaceInFile(templateFileName,'<td>0</td><td>A</td><td>B</td>',res)