fix wordcount on one-chapter stories
authorNiki Roo <niki@nikiroo.be>
Sun, 3 May 2020 10:37:40 +0000 (12:37 +0200)
committerNiki Roo <niki@nikiroo.be>
Sun, 3 May 2020 10:37:40 +0000 (12:37 +0200)
supported/BasicSupport.java
supported/BasicSupport_Deprecated.java

index 17cbec5a984b59c5af1e053aefabdccb2e120140..f1635589bfd70b0dca80b5972dcfd241bda895f8 100644 (file)
@@ -384,6 +384,7 @@ public abstract class BasicSupport {
                                resume.setName("");
                                resume.setNumber(1);
                                story.getChapters().add(resume);
+                               story.getMeta().setWords(resume.getWords());
 
                                String descChapterName = Instance.getInstance().getTrans()
                                                .getString(StringId.DESCRIPTION);
@@ -431,7 +432,7 @@ public abstract class BasicSupport {
                story.setChapters(new ArrayList<Chapter>());
                List<Entry<String, URL>> chapters = getChapters(pgGetChapters);
                pgGetChapters.done(); // 20%
-
+               
                if (chapters != null) {
                        Progress pgChaps = new Progress("Extracting chapters", 0,
                                        chapters.size() * 300);
@@ -462,10 +463,11 @@ public abstract class BasicSupport {
 
                                words += cc.getWords();
                                story.getChapters().add(cc);
-                               story.getMeta().setWords(words);
 
                                i++;
                        }
+                       
+                       story.getMeta().setWords(words);
 
                        pgChaps.setName("Extracting chapters");
                        pgChaps.done();
index ad030c0ced64825def174a7bfed5d81b4f00c7d9..a50ee3cf48a962a38b5ebe52b33184c956169ffd 100644 (file)
@@ -317,7 +317,6 @@ public abstract class BasicSupport_Deprecated extends BasicSupport {
 
                                                words += cc.getWords();
                                                story.getChapters().add(cc);
-                                               story.getMeta().setWords(words);
                                        } finally {
                                                if (chapIn != null) {
                                                        chapIn.close();
@@ -326,6 +325,8 @@ public abstract class BasicSupport_Deprecated extends BasicSupport {
 
                                        i++;
                                }
+                               
+                               story.getMeta().setWords(words);
 
                                pgChaps.setName("Extracting chapters");
                        } else {
@@ -340,6 +341,7 @@ public abstract class BasicSupport_Deprecated extends BasicSupport {
                                resume.setName("");
                                resume.setNumber(1);
                                story.getChapters().add(resume);
+                               story.getMeta().setWords(resume.getWords());
 
                                String descChapterName = Instance.getInstance().getTrans()
                                                .getString(StringId.DESCRIPTION);