Selaa lähdekoodia

:recycle: flip comparison if title is unseen

tags/0.9.0
J 4 vuotta sitten
vanhempi
commit
32cedf2e03
1 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 6
    2
      vue-theme/src/store/modules/arrangements.js

+ 6
- 2
vue-theme/src/store/modules/arrangements.js Näytä tiedosto

@@ -47,7 +47,6 @@ const _arrangeByAlpha = (postsList, seenTitles) => {
47 47
     const flatPacked = []
48 48
     
49 49
     const storeTitle = letter => {
50
-        if(seenTitles.includes(letter)) return
51 50
         flatPacked.push({ slug: letter, title: letter, inbetween: true })
52 51
         seenTitles.push(letter)
53 52
     }
@@ -56,7 +55,12 @@ const _arrangeByAlpha = (postsList, seenTitles) => {
56 55
         const lastWord = post.slug.split('-').filter(c => c).pop()
57 56
         const firstCharaOflastWord = lastWord[0]
58 57
         const firstCharaOfSortWord = post.sortname ? post.sortname[0] : 'z'
59
-        const charaIndex = alphabet.indexOf(firstCharaOflastWord) < alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
58
+        let charaIndex = alphabet.indexOf(firstCharaOflastWord) < alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
59
+        
60
+        // Kamaka problem
61
+        if(seenTitles.includes(letter)) {
62
+            charaIndex = alphabet.indexOf(firstCharaOflastWord) > alphabet.indexOf(firstCharaOfSortWord) ? alphabet.indexOf(firstCharaOflastWord) : alphabet.indexOf(firstCharaOfSortWord)
63
+        }
60 64
 
61 65
         storeTitle(alphabet[charaIndex])
62 66
         flatPacked.push(post)

Loading…
Peruuta
Tallenna