예제 #1
0
def getWriters(round, writerNames):
	'Get the writers.'
	writers = []
	previousLines = rating.getPreviousLines(round)
	previousAddressVoteDictionary = rating.getPreviousAddressVoteDictionary(previousLines)
	for writerName in writerNames:
		if writerName.lower() != 'icoin': # because Icoin is not writing anymore
			addWriter(previousAddressVoteDictionary, writerName, writers)
	return writers
예제 #2
0
def getRaterText(maximumWriters, round, seedString, writerNames):
	'Get the rater text.'
	previousLines = rating.getPreviousLines(round)
	previousAddressVoteDictionary = rating.getPreviousAddressVoteDictionary(previousLines)
	previousNameDictionary = {}
	writers = getWriters(round, writerNames)
	cString = cStringIO.StringIO()
	otherWriters = []
	raterWriters = []
	raters = rating.getRaterNames()
	raters.sort()
	raterSet = set(raters)
	for previousAddressVoteKey in previousAddressVoteDictionary.keys():
		previousRaters = rating.getRaters(previousAddressVoteDictionary[previousAddressVoteKey])
		for previousRater in previousRaters:
			if previousRater in previousNameDictionary:
				previousNameDictionary[previousRater].append(previousAddressVoteKey)
			else:
				previousNameDictionary[previousRater] = [previousAddressVoteKey]
	for writer in writers:
		if writer.name in raterSet:
			raterWriters.append(writer)
		else:
			otherWriters.append(writer)
	writersInRange = WriterRange(maximumWriters, otherWriters, previousNameDictionary, raterWriters)
	for raterIndex, rater in enumerate(raters):
		if raterIndex != 0:
			cString.write('\n\n\n')
		ratedWriters = writersInRange.getRatedWriters(rater)
		ratedWriters.sort(key=getWriterName)
		cString.write('Create:\n')
		cString.write('http://devtome.com/doku.php?id=rating_%s_%s\n\n' % (rater.lower(), round))
		cString.write('Copy and paste:\n')
		cString.write('Writer, Article: 0-99\n')
		for ratedWritersIndex, ratedWriter in enumerate(ratedWriters):
			articleLinkString = getArticleLinkString(ratedWriter.articles)
			if ratedWritersIndex % 3 == 0 and ratedWritersIndex > 0:
				cString.write('\n')
			if articleLinkString != '':
				cString.write('*[[wiki:user:%s]], [[%s]]: \n' % (ratedWriter.name.capitalize(), articleLinkString))
	cString.write('\n\nRater seed string: %s\n' % seedString)
	cString.write('\nWriter names:\n')
	for writerName in writerNames:
		cString.write('%s\n' % writerName)
	return cString.getvalue()