From 5d1908806b94d005ca58ca03cb195faf56edba5f Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 3 May 2020 12:37:40 +0200 Subject: [PATCH] fix wordcount on one-chapter stories --- supported/BasicSupport.java | 6 ++++-- supported/BasicSupport_Deprecated.java | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/supported/BasicSupport.java b/supported/BasicSupport.java index 17cbec5..f163558 100644 --- a/supported/BasicSupport.java +++ b/supported/BasicSupport.java @@ -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()); List> 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(); diff --git a/supported/BasicSupport_Deprecated.java b/supported/BasicSupport_Deprecated.java index ad030c0..a50ee3c 100644 --- a/supported/BasicSupport_Deprecated.java +++ b/supported/BasicSupport_Deprecated.java @@ -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); -- 2.27.0