-
Notifications
You must be signed in to change notification settings - Fork 11
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
Feat/work experience average section rating api #1383
Merged
YongChenSu
merged 7 commits into
dev
from
feat/work-experience-averageSectionRating-api
Aug 18, 2024
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
79abf99
feat: add API return value: averageSectionRating #1374
YongChenSu e1a4817
feat: parse rawRating #1374
YongChenSu 2b967c0
fix: round Rating to one decimal place
YongChenSu aa48e21
fix: change rating to toFixed(1) inside the div
YongChenSu 6794e2e
feat: add averageSectionRating in queryRelatedExperiencesGql
YongChenSu 95625cf
Merge branch 'dev' into feat/work-experience-averageSectionRating-api
YongChenSu cbd2ec3
fix: resolve layout issues on small screen devices
YongChenSu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,15 @@ import Thumbs from './Thumbs'; | |
import { Rating, RatingLabel } from './Rating'; | ||
import styles from './Rating.module.css'; | ||
|
||
const OverallRating = ({ rating, hasRatingLabel }) => { | ||
return ( | ||
<div className={cn(styles.overallRating)}> | ||
<Rating rating={rating} textYellow={hasRatingLabel} /> | ||
<div className={styles.ratingInfo}> | ||
<Thumbs rating={rating} /> | ||
{hasRatingLabel && <RatingLabel rating={rating} />} | ||
</div> | ||
const OverallRating = ({ rating, hasRatingLabel }) => ( | ||
<div className={cn(styles.overallRating)}> | ||
<Rating rating={rating} textYellow={hasRatingLabel} /> | ||
<div className={styles.ratingInfo}> | ||
<Thumbs rating={rating} /> | ||
{hasRatingLabel && <RatingLabel rating={rating} />} | ||
</div> | ||
); | ||
}; | ||
</div> | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unexpected code change ? |
||
|
||
OverallRating.propTypes = { | ||
hasRatingLabel: PropTypes.bool, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不能這樣寫,否則這樣若出現0就會有問題
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我有想過這個問題,但是不是不會有 0 的狀況出現啊?不過這樣寫,是很信任後端來的資料不為 0,好像也不是很好。
如果改成averageSectionRating !== undefined
,這樣寫由於averageSectionRating
已經從 data 解構出來,averageSectionRating
有可能是undefined
,這樣改覺得好嗎?喔,抱歉,發現我上面有講錯,ExperienceEntry 解構出來的
averageSectionRating
,undefined
或null
,兩者都會有,我想一下怎麼改先前 averageSectionRating 不為 0 的討論串
feat: 工作心得列表卡片修改 & 工作心得單篇頁面改版 #1354 (review)
討論串截圖
RatingInfo 的 Rating 是後端來的 averageSectionRating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這個 comment 當初是在討論 null / undefined,我覺得 averageSectionRating 會不存在才是重點
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
喔,抱歉,發現我上面有講錯,ExperienceEntry 解構出來的
averageSectionRating
,undefined
或null
,兩者都會有,我想一下怎麼改There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
咦,我看 code 應該只會有 undefined,竟然會有 null, undefined 都跑出來了
https://github.com/goodjoblife/WorkTimeSurvey-backend/compare/master...dev#diff-50883af379f9b860b4e4d913841f23c6008626ddfc4af43efbe3d6edf4d761a8R767
麻煩 @YongChenSu 可以分別給我
undefined 的 case
null 的 case
我覺得應該要再釐清一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mark86092 看起來是進到單篇
experiences
會出現undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我們先從 api response 來看好了
(1) null case 的 experience id
(2) undefined case 的 experience id
麻煩 @YongChenSu 可以找這兩個 case 的給我嗎?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我先釐清一下,或許可以自己解決
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修正,尚未推上去,發現是我沒將
averageSectionRating
加到queryRelatedExperiencesGql
中。趁機釐清一下,頁面資料來源
averageSectionRating
是從work-experiences
來的averageSectionRating
是從queryExperienceGql
來的averageSectionRating
是從queryRelatedExperiencesGql
來的