Commits

Luke Plant committed 53a085c

Fixed bug with duplicated verse ids

Comments (0)

Files changed (2)

lukeplant_me_uk/bibleverses/parse.py

 class Verse(StandardReprMixin):
     def __init__(self, verse, texts=None, categories=None):
         self.verse = correct_verse_ref(verse)
-        self.verseid = self.verse.replace(" ","").replace(",", "").replace(":", "").replace("-","")
+        self.verseid = self.verse.replace(" ","_").replace(",", "_").replace(":", "_").replace("-","_")
         if not texts:
             texts = {}
         if not texts.has_key('ESV'):

lukeplant_me_uk/bibleverses/web/js/bibleverses.js

     }
 }
 
+function makeVerseRef(verse) {
+    return verse.replace(/ |,|:|-/g, "_");
+}
+
 function indicateFinishedVerse(verse) {
-    var refid = verse.replace(/ |,|:|-/g, "");
+    var refid = makeVerseRef(verse);
     var elem = $('id_verseli_' + refid);
     if (elem) {
-	addElementClass(elem, "memorised");	
+	addElementClass(elem, "memorised");
 	$('id_versecb_' + refid).checked = true;
 	removeElementClass($('id_verseli_' + refid), "manuallyshown");
     }
 }
 
 function indicateUnfinishedVerse(verse) {
-    var refid = verse.replace(/ |,|:|-/g, "");
+    var refid = makeVerseRef(verse);
     var elem = $('id_verseli_' + refid);
     if (elem) {
 	var hidden_div = getFirstElementByTagAndClassName("div", "versebottom", elem);