Cloud-CV / EvalAI

:cloud: :rocket: :bar_chart: :chart_with_upwards_trend: Evaluating state of the art in AI
https://eval.ai
Other
1.77k stars 784 forks source link

AttributeError at /api/challenges/challenge/{challenge_pk}/challenge_phase/{pk} #1802

Closed RishabhJain2018 closed 5 years ago

RishabhJain2018 commented 6 years ago

Steps to Reproduce:

  1. Edit challenge phase details in a challenge
  2. Change the date to -- & submit the form.

Original message: AttributeError at /api/challenges/challenge/{challenge_pk}/challenge_phase/{pk}

Expected Message: The form should not be submitted & user should know the error.

sachinmukherjee commented 6 years ago

@RishabhJain2018 Can I work on this issue?

RishabhJain2018 commented 6 years ago

Sure! you can.

sachinmukherjee commented 6 years ago

Can you please explain where does this issue occur?

RishabhJain2018 commented 6 years ago

I have added the steps to reproduce in the description.

newbazz commented 6 years ago

I would like to work on this if no one is working

RishabhJain2018 commented 6 years ago

It seems like @sachinmukherjee is on another issue. @newbazz You can surely start working on this.

newbazz commented 6 years ago

I am not able to create a challenge due the fact that I am not able to log in.

bajcmartinez commented 6 years ago

I was taking a look and the form is not actually submitted, but it's doing a get request and not taking into consideration the changes made by the form. If I however change the date to something invalid like 2018-07-32, then I get the error.

The issue seems to be here:

vm.editChallengePhase = function(editChallengePhaseForm) {
            if (editChallengePhaseForm) {
                ...
                parameters.callback = {
                    onSuccess: function(response) {
                        var status = response.status;
                        utilities.hideLoader();
                        if (status === 200) {
                            $mdDialog.hide();
                            $rootScope.notify("success", "The challenge phase details are successfully updated!");
                        }
                    },
                    onError: function(response) {
                        utilities.hideLoader();
                        $mdDialog.hide();
                        var error = response.data;
                        $rootScope.notify("error", error);
                    }
                };
                utilities.showLoader();
                utilities.sendRequest(parameters, 'header', 'upload');
            } else {
                parameters.url = 'challenges/challenge/' + vm.challengeId + '/challenge_phase';
                parameters.method = 'GET';
                parameters.data = {};
                parameters.callback = {
                    onSuccess: function(response) {
                        var details = response.data;
                        vm.phases = details;
                        utilities.hideLoader();
                    },
                    onError: function(response) {
                        var error = response.data;
                        utilities.storeData('emailError', error.detail);
                        $state.go('web.permission-denied');
                        utilities.hideLoader();
                    }
                };
                utilities.sendRequest(parameters);
                $mdDialog.hide();
            }
        };

If the form has invalid data it just do a get but doesn't let the user know what's going on, however if the form is valid performs the post.

We can give visual feedback to the user when he's entering data in the form. And even if the user submits we can alert him to review the form instead of just doing the get request.

Additionally we should add custom validations for the dates, as for javascrit (2018-07-32) would be valid and represented as (2018-08-01), however python is crashing.

Let me know your thoughts and I can work on it, or if @newbazz is already working on it, he can also take into consideration my comments.

RishabhJain2018 commented 6 years ago

@newbazz Are you still working on it? If not, I would like @bajcmartinez to work on it.

bajcmartinez commented 6 years ago

@RishabhJain2018 not sure if @newbazz still working on this, I went ahead and submitted a PR. I found another error which I also fixed on the backend, which refers to modifying an immutable field. Please let me know your comments or if we can go ahead and merge. Thanks!

RishabhJain2018 commented 6 years ago

Thanks @bajcmartinez for the PR. I'll take a look at it.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed as there is no further activity. Thank you for your contributions.