Open
Conversation
SanAlexis
requested changes
Apr 30, 2023
| public class PollController { | ||
| //private final Po | ||
| @GetMapping("{id}") | ||
| public String display(@PathVariable long id, Model model){ |
Contributor
There was a problem hiding this comment.
God method.
This method has too much responsabilities.
| question4.setPropositions(Arrays.asList(p1, p2, p3, p4)); | ||
| poll.getQuestions().add(question4); | ||
| model.addAttribute("poll", poll); | ||
| return "poll"; |
Contributor
There was a problem hiding this comment.
No condition before returning "poll" ? Why this constant and why returning this value ?
| } | ||
|
|
||
| public static String format(Question question){ | ||
| StringBuilder builder = new StringBuilder("<h5>").append(StringUtils.defaultString(String.valueOf(question.getNumber()), "#")); |
|
|
||
| public static String format(Question question){ | ||
| StringBuilder builder = new StringBuilder("<h5>").append(StringUtils.defaultString(String.valueOf(question.getNumber()), "#")); | ||
| builder.append(") ").append(question.getFormulation()).append("</h5>"); |
Contributor
There was a problem hiding this comment.
Best to display the append iteration with multilines.
| builder.append(") ").append(question.getFormulation()).append("</h5>"); | ||
| switch (question.getAnswerType()){ | ||
| case DATE: | ||
| builder.append("<input type='date' name='question").append(question.getId()).append("'>"); |
Contributor
There was a problem hiding this comment.
Maybe you should prevent the case where parameters values could change or being injected, there's even the possibility to internationalize these values.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.