Repository: Cloud-CV/EvalAI
Issue: Add support for editing a challenge phase details
GitHub labels: enhancement

medium-difficulty

frontend

new-feature

priority-high

good first issue

## Current Status

Currently, we have all the APIs required for editing the challenge phase. UI needs to be implemented so that the challenge hosts can edit the challenge phase details on their own.

## Deliverables

Note: There is a constraint that only challenge host should be able to edit the details on the frontend and hence the edit buttons should be available to the challenge hosts only.

Edit the following features:
- [x] phase name 
- [x] phase description
- [x] start date
- [x] end date
- [x] test_annotation file (Open a dialog box showing warning "Do you really want to do this? " Also, ask the host to enter the phase name here to make sure that he/she is not drunk while doing this)
- [x] max submissions per day
- [x] max submissions 

## Hint
The UI for editing the challenge details is implemented. Please take help from there.

@RishabhJain2018 Can I take this up?

@isht3 Yes sure. Go ahead !

@RishabhJain2018 Since this is kind of a big issue, how should I commit the files? I reckon it probably shouldn't be in one big messy commit, yeah?

@isht3 having all of this as one commit sounds good. 

@deshraj okay, got it.

@RishabhJain2018 @deshraj One edit pop-up dialogue with and option to edit every item of each phase is enough, right? 
Something like, (Not completed) 
![](https://image.prntscr.com/image/aILSXbD5R92aLcS43bDnDA.png)

![](https://image.prntscr.com/image/AJpl-yH7T4uJSXci75WqpQ.png)


Yep, you got it right. 👍 

@deshraj I did search a bit, but I don't think there's an API end-point to update the `test_annotation` along with the `ChallengePhase`, the only one defined is to extract while we upload the Challenge in the beginning. So I should add the `test_annotation` field to the `ChallengePhaseSerializer`, yes?

@deshraj From the looks of it, it seems that I would have to edit the `challenge_phase_detail` view to accept the `test_annotation_file`. So, should I do a PR of the completed front-end, and then do the back-end as another PR?

@RishabhJain2018 I was wondering how to make the back-end for editing  `test_annotation_file`. Should I make a new view for updating it, or add support to the existing `challenge_phase_detail` and `ChallengePhaseSerializer`?

@isht3 The support for updating the `test_annotation` file have already been in the `challenge_phase_detail` view ( For reference please check [here](https://github.com/Cloud-CV/EvalAI/blob/master/apps/challenges/views.py#L354) ). Also, there is no need to update the `ChallengePhaseSerializer` as we already have `ChallengePhaseCreateSerializer`. Please let me know if you still have some doubts.

@RishabhJain2018 Okay I didn't notice that, I'll look into it. Thank you!

@RishabhJain2018 I'm having a hard time uploading the `test_annotation` without changing the back-end, I get this error `the submitted data was not a file. check the encoding type on the form.`, every time I upload the raw text file, am I supposed to be using `FormData` in the front-end to pre-process the file before sending it to the backendv or something?