highlight demandes when groupe instructeur updated on procedure list
This commit is contained in:
parent
50007b2aac
commit
b5030b8972
2 changed files with 51 additions and 1 deletions
|
@ -187,7 +187,7 @@ class Dossier < ApplicationRecord
|
|||
.joins('LEFT OUTER JOIN "commentaires" ON "commentaires" . "dossier_id" = "dossiers" . "id" and commentaires.updated_at > follows.messagerie_seen_at and "commentaires"."email" != \'contact@tps.apientreprise.fr\' AND "commentaires"."email" != \'contact@demarches-simplifiees.fr\'')
|
||||
|
||||
updated_demandes = joined_dossiers
|
||||
.where('champs.updated_at > follows.demande_seen_at')
|
||||
.where('champs.updated_at > follows.demande_seen_at OR groupe_instructeur_updated_at > follows.demande_seen_at')
|
||||
|
||||
updated_annotations = joined_dossiers
|
||||
.where('champs_privates_dossiers.updated_at > follows.annotations_privees_seen_at')
|
||||
|
|
|
@ -38,6 +38,13 @@ feature 'The routing', js: true do
|
|||
|
||||
victor = User.find_by(email: 'victor@inst.com').instructeur
|
||||
|
||||
# add superwoman to littéraire groupe
|
||||
find('input.select2-search__field').send_keys('superwoman@inst.com', :enter)
|
||||
perform_enqueued_jobs { click_on 'Affecter' }
|
||||
expect(page).to have_text("L’instructeur superwoman@inst.com a été affecté")
|
||||
|
||||
superwoman = User.find_by(email: 'superwoman@inst.com').instructeur
|
||||
|
||||
# add scientifique groupe
|
||||
click_on 'Groupes d’instructeurs'
|
||||
fill_in 'Ajouter un groupe', with: 'scientifique'
|
||||
|
@ -51,6 +58,11 @@ feature 'The routing', js: true do
|
|||
|
||||
marie = User.find_by(email: 'marie@inst.com').instructeur
|
||||
|
||||
# add superwoman to scientifique groupe
|
||||
find('input.select2-search__field').send_keys('superwoman@inst.com', :enter)
|
||||
perform_enqueued_jobs { click_on 'Affecter' }
|
||||
expect(page).to have_text("L’instructeur superwoman@inst.com a été affecté")
|
||||
|
||||
# publish
|
||||
publish_procedure(procedure)
|
||||
log_out(old_layout: true)
|
||||
|
@ -134,6 +146,31 @@ feature 'The routing', js: true do
|
|||
expect(page).to have_current_path(instructeur_procedures_path)
|
||||
expect(find('.procedure-stats')).not_to have_css('span.notifications')
|
||||
log_out
|
||||
|
||||
# the instructeurs who belong to scientifique AND litteraire groups manage scientifique and litterraire dossiers
|
||||
register_instructeur_and_log_in(superwoman.email)
|
||||
visit procedure_path(procedure, params: { statut: 'tous' })
|
||||
expect(page).to have_text(litteraire_user.email)
|
||||
expect(page).to have_text(scientifique_user.email)
|
||||
|
||||
# follow the dossier
|
||||
click_on scientifique_user.email
|
||||
click_on 'Suivre le dossier'
|
||||
|
||||
visit procedure_path(procedure, params: { statut: 'tous' })
|
||||
click_on litteraire_user.email
|
||||
click_on 'Suivre le dossier'
|
||||
log_out
|
||||
|
||||
# scientifique_user updates its group
|
||||
user_update_group(scientifique_user, 'littéraire')
|
||||
|
||||
# the instructeurs who belong to scientifique AND litteraire groups should have a notification
|
||||
visit new_user_session_path
|
||||
sign_in_with superwoman.user.email, password
|
||||
|
||||
expect(page).to have_current_path(instructeur_procedures_path)
|
||||
expect(find('.procedure-stats')).to have_css('span.notifications')
|
||||
end
|
||||
|
||||
def publish_procedure(procedure)
|
||||
|
@ -164,6 +201,19 @@ feature 'The routing', js: true do
|
|||
log_out
|
||||
end
|
||||
|
||||
def user_update_group(user, new_group)
|
||||
login_as user, scope: :user
|
||||
visit dossiers_path
|
||||
click_on user.dossiers.first.id.to_s
|
||||
click_on "Modifier mon dossier"
|
||||
|
||||
select(new_group, from: 'dossier_groupe_instructeur_id')
|
||||
click_on "Enregistrer les modifications du dossier"
|
||||
expect(page).to have_text(new_group)
|
||||
|
||||
log_out
|
||||
end
|
||||
|
||||
def register_instructeur_and_log_in(email)
|
||||
confirmation_email = emails_sent_to(email)
|
||||
.filter { |m| m.subject == 'Activez votre compte instructeur' }
|
||||
|
|
Loading…
Reference in a new issue