From b6d9de2efad5f7f5f0328c5f0b7be0485637f9c3 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Sat, 13 Jun 2020 12:46:39 -0700
Subject: [PATCH] Fix period spacing for long family summary, and tighten up
 family summary code a bit.

---
 src/js/slaveSummaryHelpers.js | 49 ++++++++++++++---------------------
 1 file changed, 19 insertions(+), 30 deletions(-)

diff --git a/src/js/slaveSummaryHelpers.js b/src/js/slaveSummaryHelpers.js
index a0462c928d6..6c835eb8c41 100644
--- a/src/js/slaveSummaryHelpers.js
+++ b/src/js/slaveSummaryHelpers.js
@@ -1326,8 +1326,7 @@ App.UI.SlaveSummaryImpl = function() {
 				if (_ssj) {
 					res += `${SlaveFullName(_ssj)}'s ${getPronouns(slave).daughter}`;
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTermShort(slave);
-						res += ` & ${friendShipShort}`;
+						res += ` & ${relationshipTermShort(slave)}`;
 						handled = 1;
 					}
 				}
@@ -1347,8 +1346,7 @@ App.UI.SlaveSummaryImpl = function() {
 				if (_ssj) {
 					res += `${SlaveFullName(_ssj)}'s ${getPronouns(slave).daughter}`;
 					if (slave.relationshipTarget === _ssj.ID && handled !== 1) {
-						const friendShipShort = relationshipTermShort(slave);
-						res += ` & ${friendShipShort}`;
+						res += ` & ${relationshipTermShort(slave)}`;
 						handled = 1;
 					}
 				}
@@ -1368,8 +1366,7 @@ App.UI.SlaveSummaryImpl = function() {
 				if (_ssj) {
 					res += `${SlaveFullName(_ssj)}'s ${relativeTerm(_ssj, slave)}`;
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTermShort(slave);
-						res += ` & ${friendShipShort}`;
+						res += ` & ${relationshipTermShort(slave)}`;
 						handled = 1;
 					}
 				}
@@ -1382,8 +1379,7 @@ App.UI.SlaveSummaryImpl = function() {
 				if (_ssj) {
 					res += `${SlaveFullName(_ssj)}'s ${getPronouns(slave).sister}`;
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTermShort(slave);
-						res += `& ${friendShipShort}`;
+						res += `& ${relationshipTermShort(slave)}`;
 						handled = 1;
 					}
 				}
@@ -1394,9 +1390,7 @@ App.UI.SlaveSummaryImpl = function() {
 			if (slave.relationship > 0 && handled !== 1) {
 				const _ssj = V.slaves.find(s => s.ID === slave.relationshipTarget);
 				if (_ssj) {
-					res += `${SlaveFullName(_ssj)}'s`;
-					const friendShipShort = relationshipTermShort(slave);
-					res += ` ${friendShipShort}`;
+					res += `${SlaveFullName(_ssj)}'s ${relationshipTermShort(slave)}`;
 				}
 			} else if (slave.relationship === -3 && slave.mother !== -1 && slave.father !== -1) {
 				res += `Your ${getPronouns(slave).wife}`;
@@ -1452,13 +1446,12 @@ App.UI.SlaveSummaryImpl = function() {
 				const _ssj = V.slaves.find(s => s.ID === slave.mother);
 				if (_ssj) {
 					addText(block, `${SlaveFullName(_ssj)}'s `);
-					const tmpSpan = makeSpan(block, getPronouns(slave).daughter, "lightgreen");
+					let spanText = getPronouns(slave).daughter;
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTerm(slave);
-						tmpSpan.textContent += ` and ${friendShipShort}`;
+						spanText += ` and ${relationshipTerm(slave)}`;
 						handled = 1;
 					}
-					tmpSpan.textContent += '.';
+					makeSpan(block, spanText + '.', "lightgreen");
 				}
 			} else if (slave.mother === -1) {
 				addText(block, `Your `);
@@ -1476,13 +1469,12 @@ App.UI.SlaveSummaryImpl = function() {
 				const _ssj = V.slaves.find(s => s.ID === slave.father);
 				if (_ssj) {
 					addText(block, `${SlaveFullName(_ssj)}'s `);
-					const tmpSpan = makeSpan(block, getPronouns(slave).daughter, "lightgreen");
+					let spanText = getPronouns(slave).daughter;
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTerm(slave);
-						tmpSpan.textContent += ` and ${friendShipShort}`;
+						spanText += ` and ${relationshipTerm(slave)}`;
 						handled = 1;
 					}
-					tmpSpan.textContent += '.';
+					makeSpan(block, spanText + '.', "lightgreen");
 				}
 			} else if (slave.father === -1 && slave.father !== slave.mother) {
 				addText(block, `Your `);
@@ -1509,13 +1501,12 @@ App.UI.SlaveSummaryImpl = function() {
 				const _ssj = V.slaves.find(s => s.mother === slave.ID || s.father === slave.ID);
 				if (_ssj) {
 					addText(block, `${SlaveFullName(_ssj)}'s `);
-					const tmpSpan = makeSpan(block, relativeTerm(_ssj, slave), "lightgreen");
+					let spanText = relativeTerm(_ssj, slave);
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTerm(slave);
-						tmpSpan.textContent += ` and ${friendShipShort}`;
+						spanText += ` and ${relationshipTerm(slave)}`;
 						handled = 1;
 					}
-					tmpSpan.textContent += '.';
+					makeSpan(block, spanText + '.', "lightgreen");
 				}
 			} else if (slave.daughters > 1) {
 				if (slave.daughters > 10) {
@@ -1530,13 +1521,12 @@ App.UI.SlaveSummaryImpl = function() {
 				const _ssj = V.slaves.find(s => areSisters(s, slave) > 0);
 				if (_ssj) {
 					addText(block, `${SlaveFullName(_ssj)}'s `);
-					const tmpSpan = makeSpan(block, getPronouns(slave).sister, "lightgreen");
+					let spanText = getPronouns(slave).sister;
 					if (slave.relationshipTarget === _ssj.ID) {
-						const friendShipShort = relationshipTerm(slave);
-						tmpSpan.textContent += ` and ${friendShipShort}`;
+						spanText += ` and ${relationshipTerm(slave)}`;
 						handled = 1;
 					}
-					tmpSpan.textContent += '.';
+					makeSpan(block, spanText + '.', "lightgreen");
 				}
 			} else if (slave.sisters > 1) {
 				if (slave.sisters > 10) {
@@ -1550,11 +1540,10 @@ App.UI.SlaveSummaryImpl = function() {
 			if (slave.relationship > 0 && handled !== 1) {
 				const _ssj = V.slaves.find(s => s.ID === slave.relationshipTarget);
 				if (_ssj) {
-					const friendship = relationshipTerm(slave);
 					addText(block, `${SlaveFullName(_ssj)}'s `);
-					makeSpan(block, `${friendship}.`, "lightgreen");
+					makeSpan(block, `${relationshipTerm(slave)}.`, "lightgreen");
 				}
-			} else if (slave.relationship === -3 && slave.mother !== -1 && slave.father !== -1 && areSisters(V.PC, slave) === 0) {
+			} else if (slave.relationship === -3 && !areRelated(V.PC, slave)) {
 				makeSpan(block, `Your ${getPronouns(slave).wife}.`, "lightgreen");
 			} else if (slave.relationship === -2) {
 				makeSpan(block, "Emotionally bonded to you.", "lightgreen");
-- 
GitLab