Skip to content

Commit

Permalink
🛠️ fix incorrect original palace data #161
Browse files Browse the repository at this point in the history
  • Loading branch information
SylarLong committed Jan 2, 2024
1 parent e1e0af4 commit d3f196c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@

## v2.2.2

- 🛠️ 修复(fix)

🇨🇳

- 来因宫错误 #161

🇺🇸

- fix incorrect original palace data #161

- ✨ 改进(enhancement)

🇨🇳
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/astro/analyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/astro/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const bySolar = (
const palaces: IFunctionalPalace[] = [];
const { yearly } = getHeavenlyStemAndEarthlyBranchBySolarDate(solarDateStr, timeIndex);
const earthlyBranchOfYear = kot<EarthlyBranchKey>(yearly[1], 'Earthly');
const heavenlyStemOfYear = kot<HeavenlyStemKey>(yearly[0], 'Heavenly');
const { bodyIndex, soulIndex, heavenlyStemOfSoul, earthlyBranchOfSoul } = getSoulAndBody(
solarDateStr,
timeIndex,
Expand Down Expand Up @@ -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))),
Expand Down

0 comments on commit d3f196c

Please sign in to comment.