Skip to content

Commit

Permalink
add an information to fair score details of R1.3Q2 if no groups created
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Dec 12, 2024
1 parent cf0893e commit 9bba309
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 54 deletions.
3 changes: 2 additions & 1 deletion app/controllers/fair_score_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def details_json
def get_fair
ontology_not_found('') if params[:ontologies].nil? || params[:ontologies].empty?
@ontologies = params[:ontologies]
@groups = LinkedData::Client::Models::Group.all
begin
if @ontologies.include? ','
@fair_scores_data = create_fair_scores_data(get_fair_combined_score(@ontologies), @ontologies.split(',').length)
Expand All @@ -31,4 +32,4 @@ def get_fair
#raise StandardError, 'Error: load failed'
end
end
end
end
104 changes: 51 additions & 53 deletions app/views/fair_score/_details.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -59,65 +59,63 @@
%div.card-body
- @fair_scores_data[:criteria][:questions][index].each do |question|
%div.card.m-3{id:get_name_with_out_dot(question[0])}

%div.card-body
%div.card-title.d-flex.justify-content-between
%h6.mr-2
#{question[0]} : #{question[1]["question"]}
%div
%div.btn.text-white{class:"#{(
if question[1]["score"] > 0
'bg-obtained_color'
elsif not_implemented?(question[1])
'bg-non-applicable_color'
else
'bg-not-obtained_color'
end
)}"}
if question[1]["score"] > 0
'bg-obtained_color'
elsif not_implemented?(question[1])
'bg-non-applicable_color'
else
'bg-not-obtained_color'
end
)}"}
%span.badge.badge-pill.badge-light
#{ print_score(question[1]["score"])} / #{print_score(question[1]["maxCredits"])}
%div.mb-3
-if not_implemented?(question[1])
%span.badge.badge-pill.badge-danger{style:"white-space:normal;font-size:14px"}
#{question[1]["explanation"]}
-elsif default_score?(question[1])
%span.badge.badge-pill.badge-success{style:"white-space:normal;font-size:14px"}
#{question[1]["explanation"]}
%div
-if !not_implemented?(question[1]) && !default_score?(question[1])
-if question[1]["points"]
%button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-credits-"+get_name_with_out_dot(question[0])}
= t("fair_score.see_possible_credits")
- if question[0].eql?('R1.3Q2') && @groups.blank?
= empty_state(t('taxonomy.no_taxonomy_created', type: 'groups'))
- else
%div.mb-3
-if not_implemented?(question[1])
%span.badge.badge-pill.badge-danger{style:"white-space:normal;font-size:14px"}
#{question[1]["explanation"]}
-elsif default_score?(question[1])
%span.badge.badge-pill.badge-success{style:"white-space:normal;font-size:14px"}
#{question[1]["explanation"]}
%div
-if !not_implemented?(question[1]) && !default_score?(question[1])
-if question[1]["points"]
%button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-credits-"+get_name_with_out_dot(question[0])}
= t("fair_score.see_possible_credits")
-if question[1]["properties"]
%button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-properties-"+get_name_with_out_dot(question[0])}
= t("fair_score.see_metadata_used_properties")
%div.mt-2
%div.collapse{id:"collapse-credits-"+get_name_with_out_dot(question[0])}
%div.card.p-3
- question[1]["points"].each do |point|
%ul.list-group.list-group-flush
%li.list-group-item.d-flex.justify-content-between.align-items-center
%div.mr-2
= point["explanation"]
%span.badge.badge-pill.badge-primary
= point["score"]
-if question[1]["properties"]
%button.btn.btn-outline-primary{'data-toggle':"collapse" ,'data-target':"#collapse-properties-"+get_name_with_out_dot(question[0])}
= t("fair_score.see_metadata_used_properties")
%div.mt-2
%div.collapse{id:"collapse-credits-"+get_name_with_out_dot(question[0])}
%div.card.p-3
- question[1]["points"].each do |point|
%ul.list-group.list-group-flush
%li.list-group-item.d-flex.justify-content-between.align-items-center
%div.mr-2
= point["explanation"]
%span.badge.badge-pill.badge-primary
= point["score"]
-if question[1]["properties"]
%div.collapse{id:"collapse-properties-"+get_name_with_out_dot(question[0])}
%div.card.p-3{style:"font-size:18px"}
%div.d-flex.flex-wrap
- question[1]["properties"].each do |key, value|
%div.badge.my-2.mx-1{class:(['', 'null', '[]',nil].include?(value) ? "badge-danger" : "badge-success") ,style:"white-space:normal"}
%span
= key
%span.badge.badge-light{style:"white-space:normal"}
- if value == nil
= t("fair_score.not_found")
-elsif value == "" || value == "[]"
= t("fair_score.null")
- else
#{value}
%div.collapse{id:"collapse-properties-"+get_name_with_out_dot(question[0])}
%div.card.p-3{style:"font-size:18px"}
%div.d-flex.flex-wrap
- question[1]["properties"].each do |key, value|
%div.badge.my-2.mx-1{class:(['', 'null', '[]',nil].include?(value) ? "badge-danger" : "badge-success") ,style:"white-space:normal"}
%span
= key
%span.badge.badge-light{style:"white-space:normal"}
- if value == nil
= t("fair_score.not_found")
-elsif value == "" || value == "[]"
= t("fair_score.null")
- else
#{value}

0 comments on commit 9bba309

Please sign in to comment.