Skip to content

Commit

Permalink
Merge branch 'gig/7093-fix-duplicate-occurrence-point-bug' into gig/7…
Browse files Browse the repository at this point in the history
…093-admin-unit-picklist
  • Loading branch information
gigxz committed Feb 4, 2025
2 parents c53fcea + fe8f830 commit c34056e
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 53 deletions.
3 changes: 2 additions & 1 deletion app/controllers/cohorts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def create

# If the user doesn't have All Cohorts access, grant them access to the cohort
@cohort.replace_access(current_user, scope: :editor)
@cohort.replace_access(current_user, scope: :viewer)
# Always add the cohort to the system group
AccessGroup.maintain_system_groups(group: :cohorts)
# Add default tabs
Expand All @@ -150,7 +151,7 @@ def create
end
end
# Search the list so you can see the newly created cohort
redirect_to cohorts_path('q[name_cont]' => @cohort.name)
redirect_to cohorts_path('search_form[q]' => @cohort.name)
rescue Exception => e
flash[:error] = e.message
redirect_to cohorts_path
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/notification_configurations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ def destroy
helper_method :import_threshold

def notification_configuration
@notification_configuration ||= GrdaWarehouse::NotificationConfiguration.find_safely(params[:id]) ||
@notification_configuration ||= if params[:id].present?
GrdaWarehouse::NotificationConfiguration.find_safely(params[:id])
else
GrdaWarehouse::NotificationConfiguration.new(
source: import_threshold,
notification_slug: import_threshold.valid_notification_slug(params[:notification_slug]),
)
end
end
helper_method :notification_configuration
end
6 changes: 5 additions & 1 deletion app/controllers/project_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def index

def new
@project_group = project_group_source.new
set_access
set_group_access
end

def create
Expand Down Expand Up @@ -166,6 +166,10 @@ def set_project_group

def set_access
@editor_ids = @project_group.editable_access_control.user_ids
set_group_access
end

def set_group_access
# TODO: START_ACL remove when ACL transition complete
@groups = @project_group.access_groups
@group_ids = @project_group.access_group_ids
Expand Down
101 changes: 60 additions & 41 deletions config/brakeman.ignore

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,16 @@ def for_project(project)

create_form_struct(
definition: definition,
legacy: false, # not legacy, because there is an active Form Instance enabling it
data_collected_about: best_instance.data_collected_about,
legacy: false, # not legacy, because there is an active Form Instance enabling it
)
end.compact
end

private

# Occurrence Point forms that are enabled for this Enrollment via an active form instance
def active_for_enrollment(enrollment)
# Get definitions for Occurrence Point forms, including inactive/retired (but excluding drafts)
# definitions = Hmis::Form::Definition.with_role(:OCCURRENCE_POINT).published_or_retired.latest_versions

# Filter to only those Occurrence Point Forms that are enabled for this
occurrence_point_definition_scope.map do |definition|
# Choose the most specific Instance that enables this FormDefinition for this Enrollment
best_instance = definition.instances.active.order(updated_at: :desc).detect_best_instance_for_enrollment(enrollment: enrollment)
Expand All @@ -54,8 +51,8 @@ def active_for_enrollment(enrollment)

create_form_struct(
definition: definition,
legacy: false, # not legacy, because there is an active Form Instance enabling it
data_collected_about: best_instance.data_collected_about,
legacy: false, # not legacy, because there is an active Form Instance enabling it
)
end.compact
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def title_for(household_category, demographic_category)

# this must be for a PH project, exluding RRH
valid_project_types = HudUtility2024.permanent_housing_project_types - [HudUtility2024.project_type_number('PH - RRH')]
valid_project = valid_project_types.include?(spm_member.enrollment.project.project_type)
valid_project = valid_project_types.include?(spm_member.enrollment&.project&.project_type)

valid_project && valid_move_in && valid_exit
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%table.table.table-striped.mb-0
%thead
%tr
- age_label = if can_view_full_dob? then 'DOB' else 'Age' end
- age_label = if current_user.can_view_full_dob? then 'DOB' else 'Age' end
%th Client
%th= age_label
%th Last Seen
Expand All @@ -22,7 +22,7 @@
- pii = client.pii_provider(user: current_user)
- projects = client.last_intentional_contacts( current_user, include_confidential_names: false, include_dates: true).select(&:present?)
%tr
%td= link_to_if can_view_clients?, pii.full_name, appropriate_client_path(client)
%td= link_to_if current_user.can_view_clients?, pii.full_name, appropriate_client_path(client)
%td= pii.dob_or_age
%td
- projects.each do |p|
Expand Down

0 comments on commit c34056e

Please sign in to comment.