-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add assessment for managers and leaders
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/models/data_analysis/assessment_for_leaders_and_managers.rb
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module DataAnalysis | ||
class AssessmentForLeadersAndManagers | ||
include ToCsv | ||
|
||
class << self | ||
# @note Personally identifiable information must not be revealed | ||
# @return [Array<String>] | ||
def column_names | ||
%w[ | ||
user_id | ||
training_module | ||
score | ||
passed | ||
started_at | ||
completed_at | ||
] | ||
end | ||
|
||
# @return [Array<Hash{Symbol => Mixed}>] | ||
def dashboard | ||
filtered_assessment.select(*column_names).map do |user| | ||
decorator.call user.attributes.symbolize_keys.except(:id) | ||
end | ||
end | ||
|
||
# @param mod [Training::Module] | ||
# @return [Integer] | ||
def filtered_assessment | ||
User.with_assessments.leader_or_manager | ||
end | ||
|
||
private | ||
|
||
# @return [CoercionDecorator] | ||
def decorator | ||
@decorator ||= CoercionDecorator.new | ||
end | ||
end | ||
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