Commit 9174ef492444dc066ef8e51ba3cdb0af9b3d4018
Committed by
Rafael Manzo
1 parent
cbb5c943
Exists in
colab
and in
4 other branches
WIP: Fixing compound metric configuration create acceptance test
Signed off by: Diego Araújo <diegoamc90@gmail.com>
Showing
7 changed files
with
26 additions
and
24 deletions
Show diff stats
app/controllers/compound_metric_configurations_controller.rb
| ... | ... | @@ -3,7 +3,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle |
| 3 | 3 | |
| 4 | 4 | def create |
| 5 | 5 | super |
| 6 | - metric_configuration.metric_snapshot.compound = true | |
| 6 | + metric_configuration.metric.type = "CompoundMetricSnapshot" | |
| 7 | 7 | respond_to do |format| |
| 8 | 8 | create_and_redir(format) |
| 9 | 9 | end |
| ... | ... | @@ -40,6 +40,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle |
| 40 | 40 | end |
| 41 | 41 | |
| 42 | 42 | def update_metric_configuration (new_metric_configuration) |
| 43 | + @kalibro_configuration_id = params[:kalibro_configuration_id] | |
| 43 | 44 | @compound_metric_configuration = new_metric_configuration |
| 44 | 45 | end |
| 45 | 46 | |
| ... | ... | @@ -56,7 +57,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle |
| 56 | 57 | |
| 57 | 58 | set_metric_configurations |
| 58 | 59 | format.html { render action: destiny_action } |
| 59 | - format.json { render json: @compound_metric_configuration.errors, status: :unprocessable_entity } | |
| 60 | + format.json { render json: @compound_metric_configuration.kalibro_errors, status: :unprocessable_entity } | |
| 60 | 61 | end |
| 61 | 62 | |
| 62 | 63 | #Code extracted from create action | ... | ... |
app/views/compound_metric_configurations/_created_metric.html.erb
app/views/compound_metric_configurations/_form.html.erb
| ... | ... | @@ -8,22 +8,6 @@ |
| 8 | 8 | |
| 9 | 9 | <div class="form-row"> |
| 10 | 10 | <div class="field-container"> |
| 11 | - <%= f.label :code, class: 'control-label' %> | |
| 12 | - <%= f.text_field :code, :required => true, class: 'text-field form-control' %> | |
| 13 | - </div> | |
| 14 | - <div class="help-container"> | |
| 15 | - <p> | |
| 16 | - A variable that holds the value of a metric calculation. It can be used in the script of another compound metric. | |
| 17 | - </p> | |
| 18 | - <p> | |
| 19 | - Example: | |
| 20 | - Code foo := 10 | |
| 21 | - </p> | |
| 22 | - </div> | |
| 23 | - </div> | |
| 24 | - | |
| 25 | - <div class="form-row"> | |
| 26 | - <div class="field-container"> | |
| 27 | 11 | <%= f.label :weight, class: 'control-label' %> |
| 28 | 12 | <%= f.text_field :weight, :required => true, class: 'text-field form-control' %> |
| 29 | 13 | </div> |
| ... | ... | @@ -53,4 +37,4 @@ |
| 53 | 37 | </div> |
| 54 | 38 | <br> |
| 55 | 39 | <%= f.submit 'Save', class: 'btn btn-primary' %> |
| 56 | -<%= link_to 'Back', kalibro_configuration_path(@compound_metric_configuration.configuration_id), class: 'btn btn-default' %> | |
| 40 | +<%= link_to 'Back', kalibro_configuration_path(@kalibro_configuration_id), class: 'btn btn-default' %> | ... | ... |
app/views/compound_metric_configurations/_metric_options.html.erb
| ... | ... | @@ -45,4 +45,20 @@ |
| 45 | 45 | </p> |
| 46 | 46 | </div> |
| 47 | 47 | </div> |
| 48 | + | |
| 49 | + <div class="form-row"> | |
| 50 | + <div class="field-container"> | |
| 51 | + <%= f.label :code, class: 'control-label' %> | |
| 52 | + <%= f.text_field :code, :required => true, class: 'text-field form-control' %> | |
| 53 | + </div> | |
| 54 | + <div class="help-container"> | |
| 55 | + <p> | |
| 56 | + A variable that holds the value of a metric calculation. It can be used in the script of another compound metric. | |
| 57 | + </p> | |
| 58 | + <p> | |
| 59 | + Example: | |
| 60 | + Code foo := 10 | |
| 61 | + </p> | |
| 62 | + </div> | |
| 63 | + </div> | |
| 48 | 64 | <%= f.hidden_field(:compound, { value: "true"}) %> | ... | ... |
app/views/compound_metric_configurations/new.html.erb
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | <br> |
| 8 | 8 | |
| 9 | -<%= form_for(@compound_metric_configuration, :url => kalibro_configuration_compound_metric_configurations_path(@compound_metric_configuration.configuration_id)) do |f| %> | |
| 9 | +<%= form_for(@compound_metric_configuration, :url => kalibro_configuration_compound_metric_configurations_path(@kalibro_configuration_id)) do |f| %> | |
| 10 | 10 | <%= render partial: 'form', locals: {f: f} %> |
| 11 | 11 | <% end %> |
| 12 | 12 | ... | ... |
features/compound_metric_configuration/create.feature
| ... | ... | @@ -24,9 +24,10 @@ Feature: Compound Metric Configuration Creation |
| 24 | 24 | And I set the select field "Scope" as "Class" |
| 25 | 25 | And I set the select field "Reading Group" as "Scholar" |
| 26 | 26 | And I press the Save button |
| 27 | + And I take a picture of the page | |
| 27 | 28 | When I click the show link of "My Compound Metric" |
| 28 | 29 | Then I should see "My Compound Metric" |
| 29 | 30 | And I should see "mcm" |
| 30 | 31 | And I should see "8" |
| 31 | 32 | And I should see "AVERAGE" |
| 32 | - | |
| 33 | 33 | \ No newline at end of file |
| 34 | + | ... | ... |
features/step_definitions/compound_metric_configuration_steps.rb
| ... | ... | @@ -3,7 +3,7 @@ Given(/^I see the sample metric configuration name$/) do |
| 3 | 3 | end |
| 4 | 4 | |
| 5 | 5 | Given(/^I see the sample metric configuration code$/) do |
| 6 | - expect(page).to have_content(@metric_configuration.code) | |
| 6 | + expect(page).to have_content(@metric_configuration.metric.code) | |
| 7 | 7 | end |
| 8 | 8 | |
| 9 | 9 | Given(/^I have a sample compound metric configuration within the given mezuro configuration$/) do | ... | ... |