Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: GonghakDao #60

Conversation

gmltn9233
Copy link
Contributor

@gmltn9233 gmltn9233 commented Aug 18, 2024

๐Ÿ”ง์—ฐ๊ฒฐ๋œ ์ด์Šˆ

๐Ÿ› ๏ธ์ž‘์—… ๋‚ด์šฉ

  • GonghakDao์˜ findStandard ๋ฉ”์„œ๋“œ๋ฅผ ์ตœ์‹ ๋…„๋„์— ํ•ด๋‹นํ•˜๋Š” ํ•™๊ณผ ๊ธฐ์ค€์„ ๋ถˆ๋Ÿฌ์˜ค๋„๋ก ๋ณ€๊ฒฝํ•˜๊ณ  ์—ฐ๊ด€๋œ ์‚ฌํ•ญ๋“ค์„ ๋ณ€๊ฒฝ์‚ฌํ•ญ์— ๋งž๊ฒŒ ๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค.

๐Ÿคทโ€โ™‚๏ธPR์ด ํ•„์š”ํ•œ ์ด์œ 

  • ๊ธฐ์กด์˜ '์‚ฌ์šฉ์ž์˜ ์ž…ํ•™๋…„๋„' ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ธ์ฆ ๊ธฐ์ค€์„ ๊ฐ€์ ธ์˜ค๋Š” ์ž˜๋ชป๋œ ๋ฐฉ์‹์—์„œ '์ตœ์‹ ๋…„๋„' ๊ธฐ์ค€์œผ๋กœ ์ธ์ฆ ๊ธฐ์ค€์„ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค.
  • '๊ธฐ์ค€ ํ•™์ ' ์™ธ '์„ธ๋ถ€ ์‚ฌํ•ญ' ๋“ค์€ ์‚ฌ์šฉ์ž์˜ ์ž…ํ•™๋…„๋„๋ฅผ ๊ธฐ์ค€์‚ผ๋Š”๊ฒƒ์ด ๋งž์•„์„œ ๊ธฐ์กด์˜ ์ถ”์ฒœ๋กœ์ง์€ ๋”ฐ๋กœ ์ˆ˜์ •ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

โœ”๏ธPR ์ฒดํฌ๋ฆฌ์ŠคํŠธ

  • ํ•„์š”ํ•œ ํ…Œ์ŠคํŠธ๋ฅผ ์ž‘์„ฑํ–ˆ๋Š”๊ฐ€?
  • ๋‹ค๋ฅธ ์ฝ”๋“œ๋ฅผ ๊นจ๋œจ๋ฆฌ์ง€ ์•Š์•˜๋Š”๊ฐ€?
  • ์—ฐ๊ฒฐ๋œ ์ด์Šˆ ์™ธ์— ๋‹ค๋ฅธ ์ด์Šˆ๋ฅผ ํ•ด๊ฒฐํ•œ ์ฝ”๋“œ๊ฐ€ ๋‹ด๊ฒจ์žˆ๋Š”๊ฐ€?

findStandard ๋ฉ”์„œ๋“œ๋ฅผ ์ตœ์‹ ๋…„๋„ ๊ธฐ์ค€์„ ๋ถˆ๋Ÿฌ์˜ค๋„๋ก ๋ณ€๊ฒฝํ•˜๊ณ  ์—ฐ๊ด€๋œ ์‚ฌํ•ญ๋“ค์„ ๋ณ€๊ฒฝ์‚ฌํ•ญ์— ๋งž๊ฒŒ ๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค.
Copy link
Contributor

@whxogus215 whxogus215 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋ฆฌํŒฉํ† ๋งํ•œ ์ฝ”๋“œ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ‘ ๊ณตํ•™์ธ์ฆ ๊ธฐ์ค€์„ ๊ฐ€์ ธ์˜ฌ ๋•Œ, ์ตœ์‹ ๋…„๋„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๊ฐ€์ ธ์˜ฌ ๊ฒฝ์šฐ, ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ํ•™๊ณผ๋Š” ์—†๋Š”๊ฑด๊ฐ€์š”? ํ˜„์žฌ ๋ฐ์ดํ„ฐ ์‚ฌ์ด์–ธ์Šคํ•™๊ณผ์˜ 24๋…„๋„ ์ž๋ฃŒ๊ฐ€ ์—†๋Š”๊ฑธ๋กœ ์•Œ๊ณ  ์žˆ๋Š”๋ฐ ์ด ๊ฒฝ์šฐ์—๋„ ๋กœ์ง์ƒ์— ๋ฌธ์ œ๊ฐ€ ์—†๋Š”๊ฑด์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

// log.info("year = {}",year);
return changeToGonghakStandardDto(majorsDomain, year);
public Optional<GonghakStandardDto> findStandard(MajorsDomain majorsDomain){
return changeToGonghakStandardDto(majorsDomain, YEAR);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ธฐ์ค€์ด ์ตœ์‹ ๋…„๋„ ๊ธฐ์ค€์ด๊ตฐ์š”! YEAR๋ผ๋Š” ๊ฒƒ์ด ์ตœ์‹ ๋…„๋„๋ผ๋Š” ๊ฒƒ์„ ๊ฐ•์กฐํ•˜๊ธฐ ์œ„ํ•ด LATEST_YEAR ๊ฐ™์ด ๋ถ€๊ฐ€์ ์ธ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•˜๋ฉด ์˜๋ฏธ๊ฐ€ ๋” ์ž˜ ์ „๋‹ฌ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ธฐ์ค€์ด ์ตœ์‹ ๋…„๋„ ๊ธฐ์ค€์ด๊ตฐ์š”! YEAR๋ผ๋Š” ๊ฒƒ์ด ์ตœ์‹ ๋…„๋„๋ผ๋Š” ๊ฒƒ์„ ๊ฐ•์กฐํ•˜๊ธฐ ์œ„ํ•ด LATEST_YEAR ๊ฐ™์ด ๋ถ€๊ฐ€์ ์ธ ๋‚ด์šฉ์„ ์ถ”๊ฐ€ํ•˜๋ฉด ์˜๋ฏธ๊ฐ€ ๋” ์ž˜ ์ „๋‹ฌ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

์ €๋„ ํ•ด๋‹น ๋ถ€๋ถ„์„ ๊ณ ๋ คํ–ˆ๋Š”๋ฐ, LATEST_YEAR ๊ฐ€ ์ข€ ๋” ์ง๊ด€์ ์ธ๊ฒƒ ๊ฐ™๋„ค์š”. ์ˆ˜์ •ํ•ด์„œ ๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค!

@@ -25,9 +25,9 @@ public class GonghakCalculateService {
@Transactional(readOnly = true)
public Optional<GonghakResultDto> getResultRatio(UserDomain userDomain) {

// findStandard -> ํ•™๋ฒˆ ์ž…ํ•™๋…„๋„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•ด๋‹น ๋…„๋„์˜ abeekType(์˜์—ญ๋ณ„ ๊ตฌ๋ถ„),minCredit(์˜์—ญ๋ณ„ ์ธ์ฆํ•™์ ) ๋ถˆ๋Ÿฌ์˜จ๋‹ค.
// findLatestStandard -> ํ•™๋ฒˆ ์ž…ํ•™๋…„๋„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ํ•ด๋‹น ๋…„๋„์˜ abeekType(์˜์—ญ๋ณ„ ๊ตฌ๋ถ„),minCredit(์˜์—ญ๋ณ„ ์ธ์ฆํ•™์ ) ๋ถˆ๋Ÿฌ์˜จ๋‹ค.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findLatestStandard๋ผ๋Š” ๋œป์€ ์ตœ์‹ ๋…„๋„์˜ ๊ณตํ•™์ธ์ฆ ๊ธฐ์ค€ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค๋Š” ์˜๋ฏธ๋กœ ์ž‘์„ฑํ•œ๊ฑด๊ฐ€์š”?? ์•„๋‹ˆ๋ฉด ์ถ”ํ›„์— findLatestStandard๋ผ๋Š” ๋ฉ”์„œ๋“œ๊ฐ€ ์ถ”๊ฐ€๋  ์ˆ˜ ์žˆ๋Š”๊ฑด๊ฐ€์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findLatestStandard๋ผ๋Š” ๋œป์€ ์ตœ์‹ ๋…„๋„์˜ ๊ณตํ•™์ธ์ฆ ๊ธฐ์ค€ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค๋Š” ์˜๋ฏธ๋กœ ์ž‘์„ฑํ•œ๊ฑด๊ฐ€์š”?? ์•„๋‹ˆ๋ฉด ์ถ”ํ›„์— findLatestStandard๋ผ๋Š” ๋ฉ”์„œ๋“œ๊ฐ€ ์ถ”๊ฐ€๋  ์ˆ˜ ์žˆ๋Š”๊ฑด๊ฐ€์š”?

์ œ์ผ ์ฒ˜์Œ findStandard ๋ฉ”์„œ๋“œ๋ฅผ ๋‚จ๊ฒจ๋‘” ์ฑ„๋กœ findLatestStandard ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ–ˆ๋Š”๋ฐ, ๋ฆฌํŒฉํ† ๋งํ•˜๋‹ค๋ณด๋‹ˆ findStandard ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๊ฐ€ ์—†์–ด, findLatestStandard ๋ฉ”์„œ๋“œ๋ฅผ findStandard ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊ฟจ์Šต๋‹ˆ๋‹ค.
์ด ๊ณผ์ •์—์„œ ์ฃผ์„์ด ์ตœ์‹ ํ™”๊ฐ€ ์•ˆ๋œ๊ฒƒ ๊ฐ™๋„ค์š” ใ… ใ…  ์˜ˆ๋ฆฌํ•œ ์ง€์  ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค๐Ÿ‘

@gmltn9233
Copy link
Contributor Author

gmltn9233 commented Aug 19, 2024

๋ฆฌํŒฉํ† ๋งํ•œ ์ฝ”๋“œ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ‘ ๊ณตํ•™์ธ์ฆ ๊ธฐ์ค€์„ ๊ฐ€์ ธ์˜ฌ ๋•Œ, ์ตœ์‹ ๋…„๋„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๊ฐ€์ ธ์˜ฌ ๊ฒฝ์šฐ, ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š” ํ•™๊ณผ๋Š” ์—†๋Š”๊ฑด๊ฐ€์š”? ํ˜„์žฌ ๋ฐ์ดํ„ฐ ์‚ฌ์ด์–ธ์Šคํ•™๊ณผ์˜ 24๋…„๋„ ์ž๋ฃŒ๊ฐ€ ์—†๋Š”๊ฑธ๋กœ ์•Œ๊ณ  ์žˆ๋Š”๋ฐ ์ด ๊ฒฝ์šฐ์—๋„ ๋กœ์ง์ƒ์— ๋ฌธ์ œ๊ฐ€ ์—†๋Š”๊ฑด์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

findStandard ๋ฉ”์„œ๋“œ๋Š” abeek ํ…Œ์ด๋ธ”์— ์ €์žฅ๋œ ํ•ด๋‹น ํ•™๊ณผ์˜ ์ตœ์‹ ๋…„๋„ ๊ธฐ์ค€์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฉ”์„œ๋“œ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์šด์˜ DB์—์„œ๋Š” abeek ํ…Œ์ด๋ธ”์— ๋ชจ๋“  ํ•™๊ณผ ์ •๋ณด๊ฐ€ ์กด์žฌํ•˜๋ฏ€๋กœ ๋กœ์ง์ƒ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜์ง„ ์•Š์Šต๋‹ˆ๋‹ค.

ํ•˜์ง€๋งŒ ๋กœ์ปฌ์—์„œ๋Š” ํ˜„์žฌ initData์—์„œ ์ˆ˜๋™์œผ๋กœ abeek ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ๊ธฐ ๋•Œ๋ฌธ์—, ๋กœ์ปฌ์—์„œ๋Š” ํ˜„์žฌ๊นŒ์ง€๋Š” ์ปด๊ณต, ์ „์ „ํ†ต ํ•™๊ณผ๋งŒ ํ…Œ์ŠคํŠธ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

ํ•ด๋‹น ์ด์Šˆ ์ถ”๊ฐ€ํ•˜์˜€์œผ๋‹ˆ ์ฐธ๊ณ  ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!
#61

์ง๊ด€์ ์ธ ์ดํ•ด๋ฅผ ์œ„ํ•ด YEAR -> LATEST_YAER ๋ณ€๊ฒฝ
@whxogus215 whxogus215 closed this Aug 19, 2024
@whxogus215 whxogus215 reopened this Aug 19, 2024
@whxogus215
Copy link
Contributor

whxogus215 commented Aug 19, 2024

์‹ค์ˆ˜๋กœ ์ž˜๋ชป ๋ˆŒ๋ €๋Š”๋ฐ ๋‹ซํ˜€๋ฒ„๋ ค์„œ ๋‹ค์‹œ ์—ด์—ˆ์Šต๋‹ˆ๋‹ค...ใ…  ์ฝ”๋ฉ˜ํŠธ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants