Skip to content
This repository was archived by the owner on Aug 21, 2018. It is now read-only.

[#870] Survey different download button name (connects #870) #1033

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/nation/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3240,6 +3240,10 @@ $(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.getFullYear() + "-" + twoDigitMonth + "-" + fullDate.getDate()
console.log(currentDate)
$.ajax({
url:'/surveyresponse/_design/bell/_view/surveyResBySurveyNo?include_docs=true',
type: 'GET',
Expand Down Expand Up @@ -3276,7 +3280,6 @@ $(function() {
async: false
});
var answerModels = answersColl.models;
console.log(answerModels.attributes)
var answersArray = [];
for(var k = 0 ; k < answerModels.length ; k++) {
answersArray.push(answerModels[k].attributes);
Expand Down Expand Up @@ -3320,7 +3323,12 @@ $(function() {
if(jsonObjectsData.length > 0) {
jsonObjectsData.sort(that.sortByProperty('QStatement'));
jsonObjectsData.sort(that.sortByProperty('QType'));
that.JSONToCSVConvertor(jsonObjectsData, surveyTitle+ '/' + surveyNo);
if(questionId == ''){
var surNo = "SurveyNo."+surveyNo
that.JSONToCSVConvertor(jsonObjectsData, surNo+ '/' + surveyTitle + '/' + currentDate);
}else{
that.JSONToCSVConvertor(jsonObjectsData, surveyTitle+ '/' + questionId);
}
} else {
alert("All the questions are un-answered, so unable to download data");
}
Expand Down