diff --git a/app/nation/app/Router.js b/app/nation/app/Router.js
index a703be334..2412491e8 100644
--- a/app/nation/app/Router.js
+++ b/app/nation/app/Router.js
@@ -2892,6 +2892,7 @@ $(function() {
App.$el.children('.body').html('
'+App.languageDictValue.get('Survey_Number') + ' '+ surveyModel.get('SurveyNo') + '
Select a Question ')
$('#addQuestion').text(App.languageDictValue.get('Add_Question'));
$('#sendSurveyBtn').text(App.languageDictValue.get('Send_to_communities'));
+ $('.directionsAndFloat').append("" +App.languageDictValue.attributes.Download+"")
$(function () {
var originalContent;
$("#dialog").dialog({
@@ -3236,7 +3237,7 @@ $(function() {
});
},
- downloadCommunitySurveys: function (surveyNo, surTitle) {
+ downloadCommunitySurveys: function (surveyNo, surTitle, questionId) {
var that = this;
$.ajax({
url:'/surveyresponse/_design/bell/_view/surveyResBySurveyNo?include_docs=true',
@@ -3274,40 +3275,43 @@ $(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);
}
for(var x = 0 ; x < answersArray.length ; x++) {
- if(answersArray[x].Answer.length > 0) {
- if(answersArray[x].Type == 'Rating Scale') {
- for(var y = 0 ; y < answersArray[x].Options.length ; y++) {
+ if(questionId == '' || (questionId && ( surveyResModels[j].questions[x] == questionId))){
+ if(answersArray[x].Answer.length > 0) {
+ if(answersArray[x].Type == 'Rating Scale') {
+ for(var y = 0 ; y < answersArray[x].Options.length ; y++) {
+ var JSONObj = {"Community":"", "Gender":"", "BirthYear":"", "Language":"", "QType":"", "QStatement":"", "Options":[], "Answer":[]};
+ JSONObj.Community = commName;
+ JSONObj.Gender = gender;
+ JSONObj.BirthYear = birthYear;
+ JSONObj.Language = memberLanguage;
+ JSONObj.QType = answersArray[x].Type;
+ JSONObj.QStatement = answersArray[x].Statement + '--' + answersArray[x].Options[y];
+ JSONObj.Options = answersArray[x].Ratings;
+ if(answersArray[x].Answer[y] != undefined) {
+ JSONObj.Answer = answersArray[x].Answer[y];
+ }
+ jsonObjectsData.push(JSONObj)
+ }
+ } else {
var JSONObj = {"Community":"", "Gender":"", "BirthYear":"", "Language":"", "QType":"", "QStatement":"", "Options":[], "Answer":[]};
JSONObj.Community = commName;
JSONObj.Gender = gender;
JSONObj.BirthYear = birthYear;
JSONObj.Language = memberLanguage;
JSONObj.QType = answersArray[x].Type;
- JSONObj.QStatement = answersArray[x].Statement + '--' + answersArray[x].Options[y];
- JSONObj.Options = answersArray[x].Ratings;
- if(answersArray[x].Answer[y] != undefined) {
- JSONObj.Answer = answersArray[x].Answer[y];
+ JSONObj.QStatement = answersArray[x].Statement;
+ if(answersArray[x].Options){
+ JSONObj.Options = answersArray[x].Options;
}
+ JSONObj.Answer = answersArray[x].Answer;
jsonObjectsData.push(JSONObj)
}
- } else {
- var JSONObj = {"Community":"", "Gender":"", "BirthYear":"", "Language":"", "QType":"", "QStatement":"", "Options":[], "Answer":[]};
- JSONObj.Community = commName;
- JSONObj.Gender = gender;
- JSONObj.BirthYear = birthYear;
- JSONObj.Language = memberLanguage;
- JSONObj.QType = answersArray[x].Type;
- JSONObj.QStatement = answersArray[x].Statement;
- if(answersArray[x].Options){
- JSONObj.Options = answersArray[x].Options;
- }
- JSONObj.Answer = answersArray[x].Answer;
- jsonObjectsData.push(JSONObj)
}
}
}
diff --git a/app/nation/app/views/SurveyQuestionRow.js b/app/nation/app/views/SurveyQuestionRow.js
index 38877cad8..a896c0bc7 100644
--- a/app/nation/app/views/SurveyQuestionRow.js
+++ b/app/nation/app/views/SurveyQuestionRow.js
@@ -46,6 +46,14 @@ $(function() {
render: function() {
var vars = this.model.toJSON();
+ var surveyObject = new App.Models.Survey({
+ _id: this.Id
+ })
+ surveyObject.fetch({
+ async: false
+ })
+ vars.surveyNo = surveyObject.get('SurveyNo')
+ vars.surveyTitle = surveyObject.get('SurveyTitle')
vars.languageDict=App.languageDictValue;
this.$el.append(this.template(vars))
},
diff --git a/app/nation/index.html b/app/nation/index.html
index 5efaed7b8..2f9ba79c1 100644
--- a/app/nation/index.html
+++ b/app/nation/index.html
@@ -645,7 +645,7 @@ <%= languageDict.attributes.viplinks %>
<%= languageDict.attributes.Details %>
-
+
<%= languageDict.attributes.Download %>
@@ -703,6 +703,7 @@ <%= languageDict.attributes.viplinks %>
<%= languageDict.attributes.EditLabel %>
+ <%= languageDict.attributes.Download %>
<%= languageDict.attributes.Remove %>