瀏覽代碼

GatherDeathCertificateDeceasedTimeLineData

Andrew Grant 2 月之前
父節點
當前提交
ebee0e3b24

+ 14 - 4
src/main/java/scot/carricksoftware/grantswriter/writer/latex/parts/people/subsections/helpers/level2/deathcertificate/GatherDeathCertificateDeceasedTimeLineDataImpl.java

@@ -34,7 +34,7 @@ public class GatherDeathCertificateDeceasedTimeLineDataImpl implements GatherDea
         logger.info("GatherDeathCertificateDeceasedTimeLineDataImpl::Gather");
         for (DeathCertificate deathCertificate : deathCertificates) {
             addWhenDied(timelineData.getTimeLine(), deathCertificate);
-  //          addWhenRegistered(timelineData.getTimeLine(), deathCertificate);
+            addWhenRegistered(timelineData.getTimeLine(), deathCertificate);
             addRefs(deathCertificate);
         }
     }
@@ -65,18 +65,28 @@ public class GatherDeathCertificateDeceasedTimeLineDataImpl implements GatherDea
     private void addWhenRegistered(TreeMap<DMY, List<String>> timeLine, DeathCertificate deathCertificate) {
         logger.info("GatherDeathCertificateDeceasedTimeLineDataImpl::AddWhenRegistered");
 
-        if (deathCertificate.getWhereRegistered() != null  && !deathCertificate.getWhereRegistered().isEmpty()) {
+        if (deathCertificate.getWhenRegistered() != null  && !deathCertificate.getWhenRegistered().isEmpty()) {
 
             List<String> existingValues = timeLine.get(getDMY(deathCertificate.getWhenRegistered()));
             if (existingValues == null) {
                 existingValues = new ArrayList<>();
             }
 
+            String informant;
+            String whereRegistered;
+
+            if (deathCertificate.getWhereRegistered() != null  && !deathCertificate.getWhereRegistered().isEmpty()) {
+                whereRegistered = deathCertificate.getWhereRegistered();
+            } else {
+                whereRegistered = deathCertificate.getRegistrationAuthority().toString();
+            }
+
             if (deathCertificate.getInformant() != null) {
-                existingValues.add("Death Registered by " + deathCertificate.getInformant().toString() + " at " + deathCertificate.getWhereRegistered());
+                informant= deathCertificate.getInformant().toString();
             } else {
-                existingValues.add("Death Registered by " + deathCertificate.getUntrackedInformant() + " at " + deathCertificate.getWhereRegistered());
+                informant = deathCertificate.getUntrackedInformant();
             }
+            existingValues.add("Death Registered by " + informant + " at " + whereRegistered);
             timeLine.put(getDMY(deathCertificate.getWhenRegistered()), existingValues);
         }
     }