version finale formulaire
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 151 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 6.5 KiB |
@ -108,7 +108,7 @@ function chartbar(Container, Datas, Categories, Title){
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return ''+
|
||||
this.x +' : '+ this.y +' personne(s) ('+ this.point.name +")";
|
||||
this.x +' : '+ this.y +' personne(s) ('+ this.point.per +")";
|
||||
}
|
||||
},
|
||||
plotOptions: {
|
||||
|
@ -119,6 +119,8 @@ font-size:0.9em;
|
||||
}
|
||||
|
||||
input[type=submit]{
|
||||
background-clip: border-box;
|
||||
background-position:5px 0px;
|
||||
display: block;
|
||||
margin:auto;
|
||||
margin-bottom:10em;
|
||||
|
@ -22,7 +22,7 @@
|
||||
-elsif item.questions_type == 4
|
||||
|
||||
-item.answers.each do |answer|
|
||||
.answer_p
|
||||
.answer_p{:style =>( "display:inline;" if item.display_type == 1)}
|
||||
=f.radio_button :content, answer.label_text
|
||||
=f.label :content, answer.label_text, :value => answer.label_text
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
||||
%td=per = number_to_percentage (tot*100.00)/(@survey.nbr_responses), :precision => 1
|
||||
|
||||
-categories << answer.label_text
|
||||
-chart_data << [per.to_s, tot]
|
||||
-chart_data << {:name => answer.label_text, :y => tot, :per => per.to_s}
|
||||
|
||||
|
||||
-count = 0
|
||||
@ -114,7 +114,7 @@
|
||||
%td=per = number_to_percentage (count*100.00)/(@survey.nbr_responses), :precision => 1
|
||||
|
||||
-categories << "non répondu"
|
||||
-chart_data << [per.to_s, count]
|
||||
-chart_data << {:name => "non répondu", :y => count, :per => per.to_s}
|
||||
|
||||
-if item.answers.where(:field_type => 2).count > 0
|
||||
-np = 0
|
||||
@ -142,10 +142,82 @@
|
||||
%script
|
||||
$(document).ready(function() {
|
||||
|
||||
=raw 'chartbar("'+r.to_s+'", '+chart_data.to_s+', '+categories.to_s+', "'+item.title+'")'
|
||||
-if item.answers.count > 4
|
||||
=raw 'chartbar("'+r.to_s+'", '+chart_data.to_json+', '+categories.to_s+', "'+item.title+'");'
|
||||
-else
|
||||
charts.push(new Highcharts.Chart(
|
||||
=raw 'getChartConfig("'+r.to_s+'", "'+item.title+'", '+chart_data.to_json+')'
|
||||
));
|
||||
|
||||
|
||||
});
|
||||
|
||||
.bar_chart{:id => r}
|
||||
-if item.questions_type == 4
|
||||
|
||||
-#chart_data = "['oui',#{oui}],['non',#{non}],['non répondu', #{nr}]"
|
||||
-chart_data = []
|
||||
-categories = []
|
||||
|
||||
%table
|
||||
-item.answers.each do |answer|
|
||||
%tr
|
||||
%td=answer.label_text
|
||||
%td
|
||||
|
||||
=tot = item.question_sets.where(:content => answer.label_text).count
|
||||
%td=per = number_to_percentage (tot*100.00)/(@survey.nbr_responses), :precision => 1
|
||||
|
||||
-categories << answer.label_text
|
||||
|
||||
|
||||
-chart_data << {:name => answer.label_text, :y => tot, :per => per.to_s}
|
||||
|
||||
|
||||
|
||||
%tr
|
||||
%td non répondu
|
||||
%td=count = item.question_sets.where(:content => nil).count
|
||||
%td=per = number_to_percentage (count*100.00)/(@survey.nbr_responses), :precision => 1
|
||||
|
||||
-categories << "non répondu"
|
||||
-chart_data << {:name => "non répondu", :y => count, :per => per.to_s}
|
||||
|
||||
-if item.answers.where(:field_type => 2).count > 0
|
||||
-np = 0
|
||||
-item.answers.where(:field_type => 2).each do |a|
|
||||
%h4
|
||||
Réponses personnalisées pour "
|
||||
=a.label_text
|
||||
"
|
||||
%table.large
|
||||
-a.answer_sets.where(:is_checked => true).each do |a|
|
||||
-if a.content?
|
||||
%tr
|
||||
%td{:colspan => 3}=a.content
|
||||
-else
|
||||
-np = np +1
|
||||
%tr
|
||||
%td
|
||||
Non précisé
|
||||
%td=np
|
||||
%td=number_to_percentage (np*100.00)/(a.answer_sets.where(:is_checked => true).count), :precision => 1
|
||||
|
||||
-r = rand 99999
|
||||
|
||||
|
||||
%script
|
||||
$(document).ready(function() {
|
||||
|
||||
-if item.answers.count > 4
|
||||
=raw 'chartbar("'+r.to_s+'", '+chart_data.to_json+', '+categories.to_s+', "'+item.title+'");'
|
||||
-else
|
||||
charts.push(new Highcharts.Chart(
|
||||
=raw 'getChartConfig("'+r.to_s+'", "'+item.title+'", '+chart_data.to_json+')'
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
.bar_chart{:id => r}
|
||||
.break
|
||||
|
15
db/seeds.rb
@ -28,8 +28,10 @@ item.answers.build(:label_text => "voyage organisé sur un weekend ou plusieurs
|
||||
|
||||
|
||||
|
||||
@survey.items.build(:questions_type => 1, :title => "La fréquence actuelle des sorties vous convient-elle ?", :item_type => 1)
|
||||
|
||||
item = @survey.items.build(:questions_type => 4, :title => "La fréquence actuelle des sorties vous convient-elle ?", :item_type => 1, :display_type => 1)
|
||||
item.answers.build(:label_text => "oui", :field_type => 1)
|
||||
item.answers.build(:label_text => "non", :field_type => 1)
|
||||
item.answers.build(:label_text => "pas totalement", :field_type => 1)
|
||||
|
||||
|
||||
item = @survey.items.build(:questions_type => 3, :title => "Quels sont les thèmes que vous préférez ?", :item_type => 1)
|
||||
@ -41,6 +43,7 @@ item.answers.build(:label_text => "jardin", :field_type => 1)
|
||||
item.answers.build(:label_text => "visite de site", :field_type => 1)
|
||||
item.answers.build(:label_text => "cabanes d’observation", :field_type => 1)
|
||||
item.answers.build(:label_text => "lecture de paysage", :field_type => 1)
|
||||
item.answers.build(:label_text => "autres", :field_type => 2)
|
||||
|
||||
|
||||
|
||||
@ -50,8 +53,10 @@ item = @survey.items.build(:questions_type => 2, :title => "Par quel(s) moyen(s)
|
||||
|
||||
|
||||
|
||||
@survey.items.build(:questions_type => 1, :title => "Êtes-vous satisfait de ce(s) mode(s) d’information(s) ?", :item_type => 1)
|
||||
|
||||
item = @survey.items.build(:questions_type => 4, :title => "Êtes-vous satisfait de ce(s) mode(s) d’information(s) ?", :item_type => 1, :display_type => 1)
|
||||
item.answers.build(:label_text => "oui", :field_type => 1)
|
||||
item.answers.build(:label_text => "non", :field_type => 1)
|
||||
item.answers.build(:label_text => "pas totalement", :field_type => 1)
|
||||
|
||||
|
||||
|
||||
@ -66,7 +71,7 @@ item.answers.build(:label_text => "autres", :field_type => 2)
|
||||
@survey.items.build(:questions_type => 1, :title => "Souhaiteriez-vous faire du covoiturage pour vous rendre sur le lieu d'une sortie ?", :item_type => 1)
|
||||
|
||||
|
||||
item = @survey.items.build(:questions_type => 2, :text_presentation => 2, :title => "Avez-vous des remarques ou commentaires à faire à propos des sorties organisée par l’association ?", :item_type => 1)
|
||||
item = @survey.items.build(:questions_type => 2, :text_presentation => 2, :title => "Avez-vous des remarques ou commentaires à faire à propos des sorties organisées par l’association ?", :item_type => 1)
|
||||
|
||||
|
||||
@survey.save
|
||||
|