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
[WIP] Fix #1705 :Adds support for editing the challenge start and end date #2144
Conversation
@Ayukha aren't you using Moment-picker ? |
5d6055e
to
d5165b1
Compare
@kurianbenoy I was about to add it |
@RishabhJain2018 Please review. |
@@ -1526,6 +1527,65 @@ | |||
} | |||
}; | |||
|
|||
// Edit Challenge Date | |||
vm.challengeDateDialog = function(ev) { | |||
vm.tempChallenge_start = vm.page.start_date; |
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 use camelCase only.
// Edit Challenge Date | ||
vm.challengeDateDialog = function(ev) { | ||
vm.tempChallenge_start = vm.page.start_date; | ||
vm.tempChallenge_end = vm.page.end_date; |
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 use camelCase only.
const start = new Date(vm.page.start_date).valueOf() | ||
const end = new Date(vm.page.end_date).valueOf() | ||
if (start < end){ | ||
|
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 this blank line.
} | ||
parameters.url = "challenges/challenge_host_team/" + vm.challengeHostId + "/challenge/" + vm.challengeId; | ||
parameters.method = 'PATCH'; | ||
const start = new Date(vm.page.start_date).valueOf() |
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.
Why are we using const
here?
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.
I have changed it to var
var status = response.status; | ||
if (status === 200) { | ||
$mdDialog.hide(); | ||
$rootScope.notify("success", "The challenge Date is successfully updated!"); |
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 add different messages for editing challenge start and end date. Something like
The challenge start date is updated.
when start date is updated and same for end date.
utilities.sendRequest(parameters); | ||
} else { | ||
vm.page.start_date = vm.tempChallenge_start; | ||
vm.page.end_date = vm.tempChallenge_end; |
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 use camelCase only.
@@ -39,6 +39,7 @@ | |||
vm.columnIndexSort = 0; | |||
// save initial ranking | |||
vm.initial_ranking = {}; | |||
vm.status = ""; |
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.
What is the use of this variable? Am I missing something?
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.
@RishabhJain2018 I am using this variable in ng-if
to render edit startdate/enddate
form.
<div class="col s12 m12"> | ||
<div class="ev-card-body pd-20 font-size-16"> | ||
<form name="editChallengeDateForm" ng-submit="challenge.editChallengeDate(editChallengeDateForm.$valid)"> | ||
<div class="pass-date">Edit Challenge Date</div> |
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 add it appropriately for both start and end dates like Edit challenge start date
and Edit challenge end date
placeholder="End Date"> | ||
|
||
|
||
|
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 this space
ng-model-options="{ updateOn: 'blur' }" | ||
moment-picker="ctrl.input" | ||
placeholder="Start Date"> | ||
|
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 this blank space.
@RishabhJain2018 Done the suggested changes, Please review. |
@Ayukha Can you please resolve the conflicts and update the PR with the master branch? |
@Ayukha can you update branch & resolve conflicts? |
@galipremsagar I am busy with my exams, I'll update it and the other PRs in a day or two. |
Closing this since it is already added. |
Thanks @Ayukha for the efforts. |
Add functionality to edit the challenge start date and end date on frontend.
Add a check to make sure that challenge end date is always after challenge start date.
Use this(https://indrimuska.github.io/angular-moment-picker/) package for adding date-time support.
#1705