Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

Ayukha
Copy link
Member

@Ayukha Ayukha commented Feb 20, 2019

  • 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

@Ayukha Ayukha marked this pull request as ready for review February 20, 2019 17:53
@kurianbenoy
Copy link
Contributor

@Ayukha aren't you using Moment-picker ?

@Ayukha
Copy link
Member Author

Ayukha commented Feb 23, 2019

@kurianbenoy I was about to add it

@Ayukha
Copy link
Member Author

Ayukha commented Feb 23, 2019

@RishabhJain2018 Please review.

@@ -1526,6 +1527,65 @@
}
};

// Edit Challenge Date
vm.challengeDateDialog = function(ev) {
vm.tempChallenge_start = vm.page.start_date;
Copy link
Member

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;
Copy link
Member

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){

Copy link
Member

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()
Copy link
Member

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?

Copy link
Member Author

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!");
Copy link
Member

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;
Copy link
Member

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 = "";
Copy link
Member

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?

Copy link
Member Author

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>
Copy link
Member

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">



Copy link
Member

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">

Copy link
Member

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 RishabhJain2018 changed the title Fix #1705 :Adds support for editing the challenge start and end date [WIP] Fix #1705 :Adds support for editing the challenge start and end date Mar 1, 2019
@Ayukha
Copy link
Member Author

Ayukha commented Mar 4, 2019

@RishabhJain2018 Done the suggested changes, Please review.

@RishabhJain2018
Copy link
Member

@Ayukha Can you please resolve the conflicts and update the PR with the master branch?

@galipremsagar
Copy link
Collaborator

@Ayukha can you update branch & resolve conflicts?

@Ayukha
Copy link
Member Author

Ayukha commented May 16, 2019

@galipremsagar I am busy with my exams, I'll update it and the other PRs in a day or two.

@RishabhJain2018
Copy link
Member

Closing this since it is already added.

@RishabhJain2018
Copy link
Member

Thanks @Ayukha for the efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants