-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from tamu-edu-students/adding-rspec-tests
all implemented rspec tests passing
- Loading branch information
Showing
8 changed files
with
190 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module SurveyProfilesHelper | ||
def full_name(survey_profile) | ||
"#{survey_profile.first_name} #{survey_profile.last_name}" | ||
end | ||
|
||
def campus_name(survey_profile) | ||
"#{survey_profile.campus_name}" | ||
end | ||
|
||
def district_name(survey_profile) | ||
"#{survey_profile.district_name}" | ||
end | ||
|
||
def get_survey_profile_id(user_id) | ||
survey_profile = SurveyProfile.find_by(user_id: user_id) | ||
survey_profile.id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
module SurveyResponsesHelper | ||
# method to calculate the average score of a survey response | ||
def average_score(survey_response) | ||
score_fields = %i[leads_by_example ability_to_juggle communicator lifelong_learner high_expectations | ||
cooperative empathetic people_oriented] | ||
scores = score_fields.map { |field| survey_response.send(field) } | ||
scores.sum.to_f / scores.size | ||
end | ||
|
||
# method to format the date of a survey response | ||
def formatted_date(survey_response) | ||
survey_response.created_at.strftime('%B %d, %Y') | ||
end | ||
|
||
# method to find the user of a survey response | ||
def user_of_response(survey_response) | ||
# returns user_id of the survey response | ||
survey_response.user_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# frozen_string_literal: true | ||
# # frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
# require 'rails_helper' | ||
|
||
RSpec.describe SurveyProfile, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end | ||
# RSpec.describe SurveyProfile, type: :model do | ||
# pending "add some examples to (or delete) #{__FILE__}" | ||
|
||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# frozen_string_literal: true | ||
# # frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
# require 'rails_helper' | ||
|
||
RSpec.describe SurveyResponse, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end | ||
# RSpec.describe SurveyResponse, type: :model do | ||
# pending "add some examples to (or delete) #{__FILE__}" | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters