diff --git a/internal/page/scrollerPage.go b/internal/page/scrollerPage.go index 02c21cf..c5ab2d1 100644 --- a/internal/page/scrollerPage.go +++ b/internal/page/scrollerPage.go @@ -74,6 +74,12 @@ import ( "rhemawavetech.com/rhemawave/internal/shaderManager" ) +const ( + defaultProclamationID string = "f3d42354-3197-45e4-9b08-be447f14386d" + proclamationPlayCount int = 10 + defaultProclamationPlayCount int = 10 +) + type Line struct { words []StringItem width int32 @@ -330,13 +336,32 @@ func (p *ScrollerPage) loadProclamations() error { return err } + var defaultProclamation db.Proclamation + err = p.Context.DbPtr.Where("ID = ?", defaultProclamationID).Find(&defaultProclamation).Error + if err != nil { + return err + } + // Build word list from selected, available proclamations + // For each proclamation in proclamations + // until count reaches 10 + // add the words into the world list + // update count + // when the count reaches 10 + // insert the defaultProclamation + // reset the count to 0 + var count int = 0 for _, proclamation := range proclamations { - if proclamation.Selected { - // Split content into words and add to list + for count < 10 { + logger.Debug("Adding %s", proclamation.Name) words := strings.Fields(proclamation.Content) p.words = append(p.words, words...) + count += 1 } + logger.Debug("Adding %s", defaultProclamation.Name) + defaultWords := strings.Fields(defaultProclamation.Content) + p.words = append(p.words, defaultWords...) + count = 0 } if len(p.words) == 0 {