-
Notifications
You must be signed in to change notification settings - Fork 2
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: Display feedback score in feedback log #3942
Merged
Merged
Changes from 2 commits
Commits
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 |
---|---|---|
|
@@ -126,6 +126,17 @@ export const CollapsibleRow: React.FC<CollapsibleRowProps> = (item) => { | |
userContext: "What were you doing?", | ||
}; | ||
|
||
enum EmojiRating { | ||
Terrible, | ||
Poor, | ||
Average, | ||
Good, | ||
Excellent, | ||
} | ||
|
||
const feedbackScore = | ||
item.feedbackScore && EmojiRating[item.feedbackScore + 1]; // enums are 0-indexed | ||
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. 👍 |
||
|
||
const renderContent = (key: string, value: any) => { | ||
if (key === "combinedHelp" && value) { | ||
return <ReactMarkdownOrHtml source={value} openLinksOnNewTab />; | ||
|
@@ -144,6 +155,7 @@ export const CollapsibleRow: React.FC<CollapsibleRowProps> = (item) => { | |
<TableCell> | ||
{format(new Date(item.createdAt), "dd/MM/yy hh:mm:ss")} | ||
</TableCell> | ||
<TableCell sx={{ textAlign: "center" }}>{feedbackScore}</TableCell> | ||
<TableCell>{commentSummary}</TableCell> | ||
<TableCell sx={{ textAlign: "right" }}> | ||
<IconButton | ||
|
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
29 changes: 29 additions & 0 deletions
29
hasura.planx.uk/migrations/1731495319577_run_sql_migration/down.sql
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- Drop the existing feedback_summary view | ||
DROP VIEW IF EXISTS public.feedback_summary; | ||
|
||
-- Recreate the feedback_summary view without feedback_score | ||
CREATE OR REPLACE VIEW "public"."feedback_summary" AS | ||
SELECT fb.id AS feedback_id, | ||
t.slug AS team_slug, | ||
f.slug AS service_slug, | ||
fb.created_at, | ||
fb.node_id, | ||
fb.device, | ||
fb.user_context, | ||
fb.user_comment, | ||
fb.feedback_type, | ||
fb.status, | ||
fb.node_type, | ||
fb.node_data, | ||
COALESCE((fb.node_data ->> 'title'::text), (fb.node_data ->> 'text'::text), (fb.node_data ->> 'flagSet'::text)) AS node_title, | ||
(fb.node_data ->> 'description'::text) AS node_text, | ||
(fb.node_data ->> 'info'::text) AS help_text, | ||
(fb.node_data ->> 'policyRef'::text) AS help_sources, | ||
(fb.node_data ->> 'howMeasured'::text) AS help_definition, | ||
COALESCE(((((fb.user_data -> 'passport'::text) -> 'data'::text) -> '_address'::text) ->> 'single_line_address'::text), ((((fb.user_data -> 'passport'::text) -> 'data'::text) -> '_address'::text) ->> 'title'::text)) AS address, | ||
((((fb.user_data -> 'passport'::text) -> 'data'::text) -> '_address'::text) ->> 'uprn'::text) AS uprn, | ||
(((fb.user_data -> 'passport'::text) -> 'data'::text) ->> 'proposal.projectType'::text) AS project_type, | ||
(((fb.user_data -> 'passport'::text) -> 'data'::text) ->> 'property.constraints.planning'::text) AS intersecting_constraints | ||
FROM ((feedback fb | ||
LEFT JOIN flows f ON ((f.id = fb.flow_id))) | ||
LEFT JOIN teams t ON ((t.id = fb.team_id))); |
26 changes: 26 additions & 0 deletions
26
hasura.planx.uk/migrations/1731495319577_run_sql_migration/up.sql
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CREATE OR REPLACE VIEW "public"."feedback_summary" AS | ||
SELECT fb.id AS feedback_id, | ||
t.slug AS team_slug, | ||
f.slug AS service_slug, | ||
fb.created_at, | ||
fb.node_id, | ||
fb.device, | ||
fb.user_context, | ||
fb.user_comment, | ||
fb.feedback_type, | ||
fb.status, | ||
fb.node_type, | ||
fb.node_data, | ||
COALESCE((fb.node_data ->> 'title'::text), (fb.node_data ->> 'text'::text), (fb.node_data ->> 'flagSet'::text)) AS node_title, | ||
(fb.node_data ->> 'description'::text) AS node_text, | ||
(fb.node_data ->> 'info'::text) AS help_text, | ||
(fb.node_data ->> 'policyRef'::text) AS help_sources, | ||
(fb.node_data ->> 'howMeasured'::text) AS help_definition, | ||
COALESCE(((((fb.user_data -> 'passport'::text) -> 'data'::text) -> '_address'::text) ->> 'single_line_address'::text), ((((fb.user_data -> 'passport'::text) -> 'data'::text) -> '_address'::text) ->> 'title'::text)) AS address, | ||
((((fb.user_data -> 'passport'::text) -> 'data'::text) -> '_address'::text) ->> 'uprn'::text) AS uprn, | ||
(((fb.user_data -> 'passport'::text) -> 'data'::text) ->> 'proposal.projectType'::text) AS project_type, | ||
(((fb.user_data -> 'passport'::text) -> 'data'::text) ->> 'property.constraints.planning'::text) AS intersecting_constraints, | ||
fb.feedback_score | ||
FROM ((feedback fb | ||
LEFT JOIN flows f ON ((f.id = fb.flow_id))) | ||
LEFT JOIN teams t ON ((t.id = fb.team_id))); |
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.
nit: since we're already in the "Feedback log", can this heading simply be "Score" (these tables don't have tons of real estate to begin with!)
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.
Good idea, I've used the word 'rating' instead given that the word (e.g. fair, good, average) is being displayed rather than the numeric value