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

updating the questions for each section based on role #81

Merged
merged 1 commit into from
Apr 17, 2024
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
81 changes: 79 additions & 2 deletions rails_root/app/controllers/survey_responses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,92 @@ def set_survey_data
@questions = @survey_response.questions
end

# rubocop:disable Metrics/MethodLength
def set_survey_sections
logger.info '========== set_survey_sections triggered =========='
# puts(session.to_json)

# return if current_user_id.nil?
return respond_with_error 'invalid form' if invalid_form?

return return_to_root 'You are not logged in.' if current_user_id.nil?
return return_to_root 'Your profile could not be found. Please complete your profile.' unless SurveyProfile.exists?(user_id: current_user_id)

@survey_profile = SurveyProfile.find_by(user_id: current_user_id)

# render based on role stored in session

if @survey_profile.role == 'Principal'

@sections = [
{
title: 'Part 1: Leadership Behavior - Management',
prompt: 'To what extent do you agree the following behaviors reflect your personal leadership behaviors?'
},
{
title: 'Part 1: Leadership Behavior - Interpersonal',
prompt: 'To what extent do you agree the following behaviors reflect your personal leadership behaviors?'
},
{
title: 'Part 2. External Forces',
prompt: 'To what extent do you believe your board or immediate superior agrees to the importance of the following?'
},
{
title: 'Part 3. Organizational Structure',
prompt: 'To what extent do you agree the following characteristics apply to your organization?'
},
{
title: 'Part 4. Values, Attitudes, and Beliefs',
prompt: 'To what extent do you agree the following characteristics apply to you as the leader?'
},
{
title: 'Part 4. Values, Attitudes, and Beliefs',
prompt: 'To what extent do you agree the following apply to your external community
(board, management, citizens)?'
}
]
end

if @survey_profile.role == 'Teacher'

@sections = [
{
title: 'Part 1: Leadership Behavior - Management',
prompt: "To what extent do you agree the following behaviors reflect your principal's leadership behaviors?"
},
{
title: 'Part 1: Leadership Behavior - Interpersonal',
prompt: "To what extent do you agree the following behaviors reflect your principal's leadership behaviors?"
},
{
title: 'Part 2. External Forces',
prompt: 'To what extent do you believe your board or immediate superior agrees to the importance of the following?'
},
{
title: 'Part 3. Organizational Structure',
prompt: 'To what extent do you agree the following characteristics apply to your organization?'
},
{
title: 'Part 4. Values, Attitudes, and Beliefs',
prompt: 'To what extent do you agree the following characteristics apply to you as the leader?'
},
{
title: 'Part 4. Values, Attitudes, and Beliefs',
prompt: 'To what extent do you agree the following apply to your external community
(board, management, citizens)?'
}
]
end
return unless @survey_profile.role == 'Superintendent'

@sections = [
{
title: 'Part 1: Leadership Behavior - Management',
prompt: 'To what extent do you agree the following behaviors reflect your personal leadership behaviors?'
prompt: "To what extent do you agree the following behaviors reflect your principal's leadership behaviors?"
},
{
title: 'Part 1: Leadership Behavior - Interpersonal',
prompt: 'To what extent do you agree the following behaviors reflect your personal leadership behaviors?'
prompt: "To what extent do you agree the following behaviors reflect your principal's leadership behaviors?"
},
{
title: 'Part 2. External Forces',
Expand All @@ -182,6 +258,7 @@ def set_survey_sections
}
]
end
# rubocop:enable Metrics/MethodLength

def invalid_form?
return false if survey_response_params.nil?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end

Then('I should see the survey questions specific to the principal') do
expect(page).to have_content('ORGANIZATIONAL AND LEADERSHIP EFFECTIVENESS INVENTORY - Principal')
expect(page).to have_content('To what extent do you agree the following behaviors reflect your personal leadership behaviors')
end

Then('I fill in my information as a teacher') do
Expand All @@ -49,7 +49,7 @@
end

Then('I should see the survey questions specific to the teacher') do
expect(page).to have_content('ORGANIZATIONAL AND LEADERSHIP EFFECTIVENESS INVENTORY - Teacher')
expect(page).to have_content("To what extent do you agree the following behaviors reflect your principal's leadership behaviors")
end

Then('I fill in my information as a superintendent') do
Expand All @@ -73,5 +73,5 @@
end

Then('I should see the survey questions specific to the superintendent') do
expect(page).to have_content('ORGANIZATIONAL AND LEADERSHIP EFFECTIVENESS INVENTORY - Superintendent')
expect(page).to have_content("To what extent do you agree the following behaviors reflect your principal's leadership behaviors")
end
Loading