diff --git a/client/src/components/CheckboxTable/CheckboxTable.jsx b/client/src/components/CheckboxTable/CheckboxTable.jsx index 34776fd..b45d4ca 100644 --- a/client/src/components/CheckboxTable/CheckboxTable.jsx +++ b/client/src/components/CheckboxTable/CheckboxTable.jsx @@ -67,6 +67,7 @@ class CheckboxTableGrid extends React.Component { componentWillMount() { const { rows, cols, CallElectionData } = this.props; + debugger; let rowHeaders = ['']; this.props.rows.map((value) => { rowHeaders.push(value.name); @@ -92,6 +93,7 @@ class CheckboxTableGrid extends React.Component { rawCount++; for (let j = 0; j < cols.length; j++) { for (let h = 0; h < CallElectionData.rowData.length; h++) { + // debugger; if (cols[j].id === CallElectionData.rowData[h].division_id && rows[i].id === CallElectionData.rowData[h].team_id) { let allow_party = { @@ -107,32 +109,40 @@ class CheckboxTableGrid extends React.Component { } this.setState({ rowData: this.state.rowData }); - this.setState({ rowHeaders, columnHeaders, checkboxGrid }); + this.setState({ rowHeaders, columnHeaders }); var rawCount = 0; var prevCol = cols[0].id; var colCount = 0; var selectedIndex = ''; - for (let i = 0; i < rows.length; i++) { + for (let m = 0; m < rows.length; m++) { + debugger; + // console.log("DDD",m); let row = []; - for (let j = 0; j < cols.length; j++) { + for (let n = 0; n < cols.length; n++) { + debugger; + // console.log("ggg",m,"rrr",n); CallElectionData.rowData.map((value) => { - if (cols[j].id === value.division_id && rows[i].id === value.team_id) { - if (prevCol === cols[j].id) { + // debugger; + // console.log("cols["+n+"].id = "+ cols[n].id+" value.division_id = "+value.division_id+" rows["+m+"].id "+rows[m].id+" value.team_id "+value.team_id); + if (cols[n].id == value.division_id && rows[m].id == value.team_id) { + console.log("cols["+n+"].id = "+ cols[n].id+" value.division_id = "+value.division_id+" rows["+m+"].id "+rows[m].id+" value.team_id "+value.team_id); + if (prevCol === cols[n].id) { colCount++; - prevCol = cols[j].id; - selectedIndex = j; + prevCol = cols[n].id; + selectedIndex = n; } else { - if (j !== cols.length - 1) { - prevCol = cols[j + 1].id; + if (n !== cols.length - 1) { + prevCol = cols[n + 1].id; } } rawCount++; - checkboxGrid[i + 1][j + 1] = true; + checkboxGrid[m + 1][n + 1] = true; } }); } } - this.findIndex(checkboxGrid); + // this.findIndex(checkboxGrid); + this.setState({checkboxGrid}); } @@ -296,6 +306,7 @@ class CheckboxTableGrid extends React.Component { pagination: false, viewColumns:false }; + debugger; return ( diff --git a/client/src/components/CheckboxTableElectionReview/CheckboxTable.jsx b/client/src/components/CheckboxTableElectionReview/CheckboxTable.jsx index 7135983..422e12b 100644 --- a/client/src/components/CheckboxTableElectionReview/CheckboxTable.jsx +++ b/client/src/components/CheckboxTableElectionReview/CheckboxTable.jsx @@ -118,8 +118,7 @@ class CheckboxTableGrid extends React.Component { let row = []; for (let j = 0; j < cols.length; j++) { rowData.map((value) => { - debugger; - if (cols[j].id === value.division_id && rows[i].id === value.team_id) { + if (cols[j].id == value.division_id && rows[i].id == value.team_id) { if (prevCol === cols[j].id) { colCount++; prevCol = cols[j].id; @@ -281,7 +280,7 @@ class CheckboxTableGrid extends React.Component { } } else { if(i!==0 && j!==1){ - colData.push(); + colData.push(); } } } diff --git a/client/src/components/NominationStep2/index.js b/client/src/components/NominationStep2/index.js index f21e3b6..0b3463a 100644 --- a/client/src/components/NominationStep2/index.js +++ b/client/src/components/NominationStep2/index.js @@ -211,6 +211,7 @@ class NominationPayments extends React.Component { } if (this.state.election && name === 'party') { + debugger; this.props.getNominationListForPayment(this.state.election, event.value); } else if (this.state.party && name === 'election') { this.props.getNominationListForPayment(event.value, this.state.party) diff --git a/client/src/components/NominationStep3/NominationStep3.jsx b/client/src/components/NominationStep3/NominationStep3.jsx index 5ac8748..0e8b368 100644 --- a/client/src/components/NominationStep3/NominationStep3.jsx +++ b/client/src/components/NominationStep3/NominationStep3.jsx @@ -148,7 +148,7 @@ class TextFields extends React.Component { } render() { const {classes,onSelectFiles,doneElement,supportdoc,closeElement,supportingDocs,handleUploadView,errorTextFileUpload} = this.props; - + debugger; const supportingDocItems = supportingDocs.map(docs => (
diff --git a/client/src/modules/election/ActiveElectionForm.jsx b/client/src/modules/election/ActiveElectionForm.jsx index 49895bc..4000e44 100644 --- a/client/src/modules/election/ActiveElectionForm.jsx +++ b/client/src/modules/election/ActiveElectionForm.jsx @@ -393,6 +393,7 @@ class ActiveElectionForm extends React.Component { const { CallElectionData,rowHeaders } = this.props; var rowHeadersForRpp = rowHeaders.filter(x => x.team_party_type === "RPP"); var rowHeadersForIg = rowHeaders.filter(x => x.team_party_type === "IND"); + debugger; const { errorTextNominationStart, errorTextNominationEnd, errorTextObjectionStart, errorTextObjectionEnd, errorTextPaymentStart, errorTextPaymentEnd, errorTextApprovalStart, errorTextApprovalEnd } = this.state; const errorTextItems = { errorTextNominationStart, errorTextNominationEnd, errorTextObjectionStart, errorTextObjectionEnd, errorTextPaymentStart, errorTextPaymentEnd, errorTextApprovalStart, errorTextApprovalEnd } diff --git a/client/src/modules/election/AllowNomination.jsx b/client/src/modules/election/AllowNomination.jsx index 1a63eac..0a66f38 100644 --- a/client/src/modules/election/AllowNomination.jsx +++ b/client/src/modules/election/AllowNomination.jsx @@ -100,7 +100,7 @@ class AllowNomination extends React.Component {
- +
diff --git a/client/src/modules/election/AllowNominationView.jsx b/client/src/modules/election/AllowNominationView.jsx index b1e54fb..7aee04b 100644 --- a/client/src/modules/election/AllowNominationView.jsx +++ b/client/src/modules/election/AllowNominationView.jsx @@ -53,6 +53,7 @@ class AllowNomination extends React.Component { render() { const { classes,electionData,errorTextElectorates ,rowData,rowHeaders} = this.props; + debugger; // const data = rowHeaders.map((record) => { // record.id = record.team_id; // record.name = record.team_name; diff --git a/client/src/modules/election/Election_process_review_details.jsx b/client/src/modules/election/Election_process_review_details.jsx index 9e6d566..c12fccc 100644 --- a/client/src/modules/election/Election_process_review_details.jsx +++ b/client/src/modules/election/Election_process_review_details.jsx @@ -325,7 +325,7 @@ class Dashboard extends React.Component { Calculation Type : - {(CalculationType === 'vote_and_prefrence') ? 'Vote & Preferential Based' : (CalculationType === 'pure_prefrence_based') ? 'Pure preference-based' : (CalculationType === 'pure_vote_based') ? 'Pure vote-based' : ''} + {CalculationType} {/* diff --git a/client/src/modules/nomination/state/NominationAction.js b/client/src/modules/nomination/state/NominationAction.js index 659bf8c..5590769 100644 --- a/client/src/modules/nomination/state/NominationAction.js +++ b/client/src/modules/nomination/state/NominationAction.js @@ -360,6 +360,7 @@ export const setNominationStatus = (nominationSuppertDocs) => { candidateSupportDocs:nominationSuppertDocs.supportdoc, divisionId:divisionId } + debugger; return function (dispatch) { const response = axios diff --git a/server/src/manager/candidate/candidateManager.js b/server/src/manager/candidate/candidateManager.js index c2ef26f..f9d5de2 100755 --- a/server/src/manager/candidate/candidateManager.js +++ b/server/src/manager/candidate/candidateManager.js @@ -1,6 +1,6 @@ -import { Candidate } from 'Models'; +import { Candidate } from 'Models'; var joinjs = require('join-js').default; -import {List} from 'typed-immutable'; +import { List } from 'typed-immutable'; import _ from 'lodash'; import moment from 'moment'; @@ -10,13 +10,13 @@ const resultMaps = [ mapId: 'candidateMap', idProperty: 'ID', // properties: ['FULL_NAME', 'DES','OCCUPATION','NIC', 'DATE_OF_BIRTH', 'GENDER','ADDRESS', 'NOMINATION_ID'] - properties: ['CONFIG_ID', 'KEY_NAME','VALUE'] + properties: ['CONFIG_ID', 'KEY_NAME', 'VALUE'] } ]; const mapToCandidateModel = (candidates) => { - console.log('candidates',candidates); + console.log('candidates', candidates); var groupedCandidates = _.groupBy(candidates, 'CANDIDATE_ID'); var expected = _.map(groupedCandidates, function (candidateProperties) { var orderedProps = []; @@ -27,40 +27,41 @@ const mapToCandidateModel = (candidates) => { }); orderedProps = _.sortBy(orderedProps, 'CANDIDATE_CONFIG_ID'); - var candidateInfoMap = {CANDIDATE_ID:id}; + var candidateInfoMap = { CANDIDATE_ID: id }; _.each(orderedProps, function (property) { - if(property.CANDIDATE_KEY_NAME === 'DATE_OF_BIRTH'){ + if (property.CANDIDATE_KEY_NAME === 'DATE_OF_BIRTH') { candidateInfoMap[property.CANDIDATE_KEY_NAME] = moment(new Date(parseInt(property.CANDIDATE_VALUE))).format('YYYY-MM-DD'); - }else{ + } else { candidateInfoMap[property.CANDIDATE_KEY_NAME] = property.CANDIDATE_VALUE; } }); - + return candidateInfoMap; }); - console.log('expected',expected); + console.log('expected', expected); return expected; // const mappedCandidates = joinjs.map(candidates, resultMaps, 'candidateMap', 'CANDIDATE_'); -// const mappedCandidates = expected; + // const mappedCandidates = expected; + + // console.log("mappedCandidatesmappedCandidatesmappedCandidates",mappedCandidates); + // return _.reduce(mappedCandidates, function(result, candidate) { -// console.log("mappedCandidatesmappedCandidatesmappedCandidates",mappedCandidates); -// return _.reduce(mappedCandidates, function(result, candidate) { - -// return result.push({ -// "id": candidate.ID, -// "configId": candidate.CONFIG_ID, -// "keyName": candidate.KEY_NAME, -// "value": candidate.VALUE + // return result.push({ + // "id": candidate.ID, + // "configId": candidate.CONFIG_ID, + // "keyName": candidate.KEY_NAME, + // "value": candidate.VALUE -// }); -// },List(Candidate)()); + // }); + // },List(Candidate)()); }; -const mapToPartyCandidateModel = (candidates,party_list,division_list) => { - console.log('candidates',candidates); +const mapToPartyCandidateModel = (candidates, party_list, division_list) => { + console.log('party_list', party_list); var groupedCandidates = _.groupBy(candidates, 'CANDIDATE_ID'); + console.log('division_list', division_list); var expected = _.map(groupedCandidates, function (candidateProperties) { var orderedProps = []; var id = ""; @@ -70,33 +71,35 @@ const mapToPartyCandidateModel = (candidates,party_list,division_list) => { }); orderedProps = _.sortBy(orderedProps, 'CANDIDATE_CONFIG_ID'); - var candidateInfoMap = {CANDIDATE_ID:id}; + var candidateInfoMap = { CANDIDATE_ID: id }; _.each(orderedProps, function (property) { - if(property.CANDIDATE_KEY_NAME === 'DATE_OF_BIRTH'){ + if (property.CANDIDATE_KEY_NAME === 'DATE_OF_BIRTH') { candidateInfoMap[property.CANDIDATE_KEY_NAME] = moment(new Date(parseInt(property.CANDIDATE_VALUE))).format('YYYY-MM-DD'); - }else{ + } else { candidateInfoMap[property.CANDIDATE_KEY_NAME] = property.CANDIDATE_VALUE; } }); - - return candidateInfoMap; - }); - - const expectedWithParty = party_list.map(item => { - //check and change the team_id variable name after finishing the party list endpoint - const item2 = expected.find(o => o.team_id === item.team_id); - return { ...item, ...item2}; - }); - const expectedWithPartyDivision = division_list.map(item => { - //check and change the vivision_id variable name after finishing the division list endpoint - const item2 = expectedWithParty.find(o => o.division_id === item.division_id); - return { ...item, ...item2}; + return candidateInfoMap; }); + if (party_list) { + const expectedWithParty = party_list.map(item => { + //check and change the team_id variable name after finishing the party list endpoint + const item2 = expected.find(o => o.team_id === item.team_id); + return { ...item, ...item2 }; + }); + } + if (division_list) { + const expectedWithPartyDivision = division_list.map(item => { + //check and change the vivision_id variable name after finishing the division list endpoint + const item2 = expectedWithParty.find(o => o.division_id === item.division_id); + return { ...item, ...item2 }; + }); + } - console.log('expected',expected); - return expectedWithPartyDivision; + console.log('expected', expected); + return expected; }; export default { diff --git a/server/src/repository/division.js b/server/src/repository/division.js index 939ab4e..6eab2d9 100644 --- a/server/src/repository/division.js +++ b/server/src/repository/division.js @@ -145,7 +145,7 @@ FROM NOMINATION N LEFT JOIN DIVISION_CONFIG DC ON N.DIVISION_CONFIG_ID=DC.ID LEFT JOIN CANDIDATE_DATA C ON N.ID=C.NOMINATION_ID LEFT JOIN CANDIDATE_CONFIG CC ON C.CANDIDATE_CONFIG_ID = CC.ID LEFT JOIN PAYMENT P ON N.ID=P.NOMINATION_ID -WHERE N.ELECTION_ID=:election_id AND N.TEAM_ID=:team_id AND N.DIVISION_CONFIG_ID=:divisionId GROUP BY N.ID,CC.ID`; +WHERE N.ELECTION_ID=:election_id AND N.TEAM_ID=:team_id GROUP BY N.ID,CC.ID`; const DIVISIONS_WITH_NOMINATION_SELECT_QUERY_ALL = `SELECT N.DIVISION_CONFIG_ID AS division_id, diff --git a/server/src/service/divisionService.js b/server/src/service/divisionService.js index b67902f..8f3dbb5 100644 --- a/server/src/service/divisionService.js +++ b/server/src/service/divisionService.js @@ -82,7 +82,7 @@ const getDivisionsWithNomination = async (req) => { const teamId = req.params.teamId; const divisionId = req.params.divisionId; const divisions = await DivisionRepo.fetchDivisionsWithNomination(electionId, teamId,divisionId); - + console.log(divisions,"divisions"); if (!_.isEmpty(divisions)) { return DivisionManager.mapToDivisionModelWithNominations(divisions); } else {