From d3f196c6884ccd741d5ba381d3a889dce6b78f0f Mon Sep 17 00:00:00 2001 From: Sylar Date: Wed, 3 Jan 2024 00:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix=20incorrect=20origi?= =?UTF-8?q?nal=20palace=20data=20#161?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 10 ++++++++++ src/__tests__/astro/analyzer.test.ts | 2 +- src/astro/astro.ts | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cde549ad..b2f542d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ ## v2.2.2 +- 🛠️ 修复(fix) + + 🇨🇳 + + - 来因宫错误 #161 + + 🇺🇸 + + - fix incorrect original palace data #161 + - ✨ 改进(enhancement) 🇨🇳 diff --git a/src/__tests__/astro/analyzer.test.ts b/src/__tests__/astro/analyzer.test.ts index 75ccc233..df6f7106 100644 --- a/src/__tests__/astro/analyzer.test.ts +++ b/src/__tests__/astro/analyzer.test.ts @@ -24,7 +24,7 @@ describe('astro/analyzer', () => { expect(result.palace(item)).toHaveProperty('name', item); }); - expect(result.palace('来因')).toHaveProperty('name', '财帛'); + expect(result.palace('来因')).toHaveProperty('name', '官禄'); expect(result.palace('身宫')).toHaveProperty('name', '命宫'); try { diff --git a/src/astro/astro.ts b/src/astro/astro.ts index dca92152..7814e52c 100644 --- a/src/astro/astro.ts +++ b/src/astro/astro.ts @@ -52,6 +52,7 @@ export const bySolar = ( const palaces: IFunctionalPalace[] = []; const { yearly } = getHeavenlyStemAndEarthlyBranchBySolarDate(solarDateStr, timeIndex); const earthlyBranchOfYear = kot(yearly[1], 'Earthly'); + const heavenlyStemOfYear = kot(yearly[0], 'Heavenly'); const { bodyIndex, soulIndex, heavenlyStemOfSoul, earthlyBranchOfSoul } = getSoulAndBody( solarDateStr, timeIndex, @@ -79,8 +80,7 @@ export const bySolar = ( name: palaceNames[i], isBodyPalace: bodyIndex === i, isOriginalPalace: - !['ziEarthly', 'chouEarthly'].includes(earthlyBranchOfPalace) && - earthlyBranchOfPalace === earthlyBranchOfYear, + !['ziEarthly', 'chouEarthly'].includes(earthlyBranchOfPalace) && heavenlyStemOfPalace === heavenlyStemOfYear, heavenlyStem: t(heavenlyStemOfPalace), earthlyBranch: t(earthlyBranchOfPalace), majorStars: majorStars[i].concat(minorStars[i].filter((star) => ['lucun', 'tianma'].includes(star.type))),