-
Notifications
You must be signed in to change notification settings - Fork 4
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
Ajout de contraintes sur les dates de début et de fin des scolarités #1253
Conversation
36d9833
to
ad05873
Compare
da012d1
to
0b184f0
Compare
@@ -34,6 +34,19 @@ class Schooling < ApplicationRecord # rubocop:disable Metrics/ClassLength | |||
validates :student, uniqueness: { scope: :end_date, message: :unique_active_schooling }, if: :open? | |||
validates :student, uniqueness: { scope: :classe }, if: :closed? | |||
|
|||
validates :end_date, | |||
:start_date, | |||
if: ->(schooling) { schooling.classe.present? }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Condition ajoutée à cause du test dans schooling_spec
(Ligne 10) :
it { is_expected.to belong_to(:classe).class_name("Classe") }
1e31825
to
ca9aac6
Compare
status { :student } | ||
|
||
after(:build) do |schooling| | ||
schooling.start_date = if schooling.end_date.present? | ||
schooling.end_date - 1.month | ||
else | ||
"#{SchoolYear.current.start_year}-01-10" | ||
Date.parse("#{schooling.classe.school_year.start_year}-09-01") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien vu!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A un moment dans le code, j'ai aussi adapté l'année des dates de la Factory 'PFMP' sur celles de la Factory 'Schooling', mais j'ai supprimé ce code quand j'ai annulé mes modifications sur le 'validates' du modèle 'PFMP'.
Est-ce qu'il faudrait que je rajoute cette logique ou non ? (Sachant que tous les tests passent actuellement)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pour l'instant c'est pas très grave je dirais.
@@ -16,12 +16,6 @@ | |||
sign_in(user) | |||
schooling.pfmps = [payment_request.pfmp] | |||
schooling.save! | |||
Timecop.safe_mode = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pas mal de pouvoir virer ca!
No description provided.