package org.xcolab.view.pages.proposals.view.contest;

import org.xcolab.client.proposals.pojo.Proposal;
import org.xcolab.commons.CsvResponseWriter;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

import javax.servlet.http.HttpServletResponse;

public class ContestProposalsCsvWriter extends CsvResponseWriter {

    private static final List<String> COLUMN_NAMES = Arrays.asList(
            "Author name", "Description", "Name", "Proposal review", "Rating comment", "Team"
    );
    private static final Function<Proposal, List<String>> COLUMN_EXTRACTION_FUNCTION
            = (proposal -> Arrays.asList(
            proposal.getAuthorName(),
            proposal.getDescription(),
            proposal.getName(),
            proposal.getProposalReview(),
            proposal.getRatingComment(),
            proposal.getTeam()
    ));

    public ContestProposalsCsvWriter(HttpServletResponse response) throws IOException {
        super("proposalList", COLUMN_NAMES, response);
    }

    public void writeMembers(List<Proposal> proposals) {
        proposals.stream()
                .map(COLUMN_EXTRACTION_FUNCTION)
                .forEach(this::writeRow);
    }
}

@@ -433,32 +433,52 @@
  Arrays.asList(%0A
+            %22Name%22,%0A
             %22Aut
@@ -485,37 +485,153 @@
 hor 
-n
+N
 ame%22,
- %22Description%22, %22Name%22,
+%0A            %22Author Full Name%22,%0A            %22Team%22,%0A            %22Description%22,%0A            %22Clean Pitch%22,%0A            %22Pitch%22,%0A           
  %22Pr
@@ -641,40 +641,289 @@
 sal 
-r
+R
 eview%22,
- %22Rating comment%22, %22Team
+%0A            %22Rating Comment%22,%0A            %22Fellow Action Comment%22,%0A            %22Impact Comment Author%22,%0A            %22Impact Comment Iaf%22,%0A            %22All Judges finished Reviews%22,%0A            %22Vote Count%22,%0A            %22Supporter Count%22,%0A            %22Absolute Proposal URL
 %22%0A  
@@ -1046,32 +1046,64 @@
  Arrays.asList(%0A
+            proposal.getName(),%0A
             prop
@@ -1152,166 +1152,618 @@
 .get
-Description(),%0A            proposal.getName(),%0A            proposal.getProposalReview(),%0A            proposal.getRatingComment(),%0A            proposal.getTeam
+Author().getFullName(),%0A            proposal.getTeam(),%0A            proposal.getDescription(),%0A            proposal.getCleanPitch(),%0A            proposal.getPitch(),%0A            proposal.getProposalReview(),%0A            proposal.getRatingComment(),%0A            proposal.getFellowActionComment(),%0A            proposal.getImpactCommentAuthor(),%0A            proposal.getImpactCommentIaf(),%0A            String.valueOf(proposal.getAllJudgesReviewFinished()),%0A            String.valueOf(proposal.getVotesCount()),%0A            String.valueOf(proposal.getSupportersCount()),%0A            proposal.getAbsoluteProposalUrl
 ()%0A 

Add additional fields to csv export