-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add poll #55
Add poll #55
Conversation
# Conflicts: # src/main/webapp/app/jsp/my-events.jsp
# Conflicts: # src/main/webapp/app/jsp/poll.jsp
display poll
# Conflicts: # src/main/java/lv/ctco/javaschool/eventorganaizer/boundary/EventOrganizationApi.java # src/main/webapp/app/jsp/poll.jsp
# Conflicts: # src/main/java/lv/ctco/javaschool/eventorganaizer/boundary/EventOrganizationApi.java
Fix function savePollToDB()
document.getElementById("edit").classList.remove("w3-hide"); | ||
document.getElementById("update").classList.remove("w3-hide"); | ||
document.getElementById("save").classList.add("w3-hide") | ||
function checkFunction() { |
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.
checkFunction?
if(data.name == "" || data.name == " ") { | ||
alert("Please input Event Name"); | ||
return; | ||
function saveDataToDB() { |
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.
refactor function
validation should be in different function
document.getElementById("agenda").value = event.eventAgenda; | ||
}) | ||
} | ||
function getEventDataFromDB() { |
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.
is it form DB ?
var pair = vars[i].split("="); | ||
if (pair[0] == variable) { | ||
return pair[1]; | ||
function getQueryVariable(variable) { |
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.
variable names ?
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.
check why it is used and remove if there is different way to get id.
src/main/webapp/app/jsp/event.jsp
Outdated
if (event.eventStatus === "OPEN") { | ||
document.getElementById("voting").classList.remove("w3-hide"); | ||
document.getElementById("feedback").classList.add("w3-hide"); | ||
getVotingFromDB(); |
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.
DB ?
src/main/webapp/app/jsp/event.jsp
Outdated
if (event.eventStatus === "CLOSED") { | ||
document.getElementById("voting").classList.add("w3-hide"); | ||
document.getElementById("feedback").classList.remove("w3-hide"); | ||
getFeedbackFromDB() |
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.
DB ?
src/main/webapp/app/jsp/poll.jsp
Outdated
<div id="displayPoll"> | ||
</div> | ||
|
||
<script> |
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.
scripts in different files
src/main/webapp/app/jsp/poll.jsp
Outdated
}) | ||
} | ||
|
||
function getQueryVariable(variable) { |
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 dublicate
…ished) function checkNonEmptyInput
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.
Please change
@Inject | ||
private AnswersStore answersStore; | ||
|
||
|
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.
Please remove extra blank line
@Path("/{id}/getVotingPoll") | ||
public List<PollDto> getVotingForEvent(@PathParam("id") Long id) { | ||
List<Poll> poll = pollStore.getVotingPoll(id); | ||
return poll.stream() |
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.
Please remove duplication by creating a mapPollToDto(poll) method
answerList.add(answer); | ||
} | ||
poll.setAnswers(answerList); | ||
em.persist(poll); |
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.
Please put db logic into corresponding Store
@Path("/{id}/savePoll") | ||
public void savePoll(PollDto pollDto, @PathParam("id") Long id) { | ||
List<AnswerDto> answersString = pollDto.getAnswers(); | ||
//String[] answerList = answersString.split("\n"); |
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.
Please remove comment if it is not needed
@Path("/{id}/savePoll") | ||
public void savePoll(PollDto pollDto, @PathParam("id") Long id) { | ||
List<AnswerDto> answersString = pollDto.getAnswers(); | ||
//String[] answerList = answersString.split("\n"); |
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.
Do not commit comments please
@Inject | ||
private AnswersStore answersStore; | ||
|
||
|
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.
Not needed extra line
…event-organizer into addPoll # Conflicts: # src/main/webapp/app/jsp/add-event.jsp # src/main/webapp/app/jsp/event.jsp # src/main/webapp/app/jsp/my-events.jsp # src/main/webapp/app/jsp/start.jsp # src/main/webapp/index.jsp # src/main/webapp/style.css
847e713
Checklist
mvn test
from the root directory to see all new and existing tests passMotivation and Context
#15
#16
#14
#41
#22
#23
#24
#50
Description
Were added opportunity to create poll and display feedback and voting in dependency of event status(open or closed) .
P.S. Not all methods covered by Unit Tests