#Compare 4 Translations
def compare_chapter4(request, translations, book, chapter, start_verse = -1, end_verse = -1): # modifying this function to be a 'catch all' for ch, verse, range etc - ah 11/23
#Grab Current Book Data
book_no_dashes = string.replace(book, '-', ' ')
b = Book.objects.get(name=book_no_dashes)
#translation string could bee 'KJV' or 'KJV-ASV-BBE' and it wil return an array of translations
p = re.compile('[A-Za-z]+')
trans_array = p.findall(translations)
trans_num = len(trans_array)
translation_set = Translation.objects.filter(activated=1)
for trans in trans_array:
translation_set = translation_set.exclude(acronym=trans)
if (start_verse != -1 and end_verse != -1):
# we have a range lookup
scripture_set = grab_verse_range(trans_acronym, book_id, chapter, start_verse, end_verse)
elif(start_verse != -1 and end_verse == -1):
# we have a single verse lookup
scripture_set = Scripture.objects.filter(translation__activated=1, verse__book=b.id, verse__chapter=chapter, verse__verse=start_verse)
else:
# we have a chapter lookup
scripture_set = Scripture.objects.filter(translation__activated=1, verse__book=b.id, verse__chapter=chapter)
#Find chapter for all translations passed
for trans in translation_set:
ac = trans.acronym
scripture_set = scripture_set.exclude(translation__acronym=trans.acronym)
#Find Next Book and Chapter To Pass To Template
next_chap = next_chapter(book_no_dashes, chapter)
#Find Previous Book and Chapter To Pass To Template
previous_chap = previous_chapter(book_no_dashes, chapter)
scripture_rows = scripture_set.count()
loops = scripture_rows/trans_num
translation_comparison = 'Before IF
' + ac + '
loops:' + str(loops) + '
scripture_rows:' + str(scripture_rows) + '
trans_num:' + str(trans_num)
translation_comparison = '
%s %s
' % (trans_array[x], book, chapter, scripture_set[row].verse.verse, scripture_set[row].verse.verse, scripture_set[row].scripture) row += 1 x += 1 translation_comparison += '