diff --git a/app/nation/app/Router.js b/app/nation/app/Router.js index 5bbefcdf4..f5e2e8b81 100644 --- a/app/nation/app/Router.js +++ b/app/nation/app/Router.js @@ -3240,6 +3240,9 @@ $(function() { downloadCommunitySurveys: function (surveyNo, surTitle, questionId) { var that = this; + var fullDate = new Date() + var twoDigitMonth = ((fullDate.getMonth().length+1) === 1)? (fullDate.getMonth()+1) :(fullDate.getMonth()+1); + var currentDate = fullDate.getDate() + "-" + twoDigitMonth + "-" + fullDate.getFullYear();; $.ajax({ url:'/surveyresponse/_design/bell/_view/surveyResBySurveyNo?include_docs=true', type: 'GET', @@ -3320,7 +3323,11 @@ $(function() { if(jsonObjectsData.length > 0) { jsonObjectsData.sort(that.sortByProperty('QStatement')); jsonObjectsData.sort(that.sortByProperty('QType')); - that.JSONToCSVConvertor(jsonObjectsData, surveyTitle+ '/' + surveyNo); + if(questionId == ''){ + that.JSONToCSVConvertor(jsonObjectsData, surveyTitle+ '/' + surveyNo+ '/' + currentDate); + }else{ + that.JSONToCSVConvertor(jsonObjectsData, surveyTitle+ '/' + questionId); + } } else { alert("All the questions are un-answered, so unable to download data"); }