Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 N'attribue le niveau 2 que quand on a commencĂ© le niveau 2 #1765

Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions app/models/restitution/place_du_marche.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def synthese
profil_numeratie: profil_numeratie }
end

# rubocop:disable Metrics/CyclomaticComplexity
def niveau_numeratie
niveau = 0
n1 = pourcentage_de_reussite_pour(:N1)
Expand All @@ -58,12 +59,13 @@ def niveau_numeratie
n3 = pourcentage_de_reussite_pour(:N3)

niveau = 1
niveau = 2 if n1 > SEUIL_MINIMUM
niveau = 3 if n2 && n2 > SEUIL_MINIMUM
niveau = 2 if n2 && n1 > SEUIL_MINIMUM
niveau = 3 if n3 && n2 > SEUIL_MINIMUM
niveau = 4 if n3 && n3 > SEUIL_MINIMUM

niveau
end
# rubocop:enable Metrics/CyclomaticComplexity

def profil_numeratie
return ::Competence::NIVEAU_INDETERMINE if niveau_numeratie.zero?
Expand Down
2 changes: 1 addition & 1 deletion spec/models/restitution/place_du_marche_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
allow(restitution).to receive(:pourcentage_de_reussite_pour).with(:N2).and_return nil
end

it { expect(restitution.niveau_numeratie).to eq 2 }
it { expect(restitution.niveau_numeratie).to eq 1 }
end

context 'quand le pourcentage de réussite pour N2 est inférieur à 70 et N3 est nil' do
Expand Down