Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
cs_comments_service
Commits
ad3aa917
Commit
ad3aa917
authored
Dec 18, 2012
by
Kevin Chugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orphan ratio KPI
parent
9052a76c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
4 deletions
+30
-4
lib/tasks/kpis.rake
+30
-4
No files found.
lib/tasks/kpis.rake
View file @
ad3aa917
...
...
@@ -112,8 +112,8 @@ namespace :kpis do
total_activity
+=
summary
[
'comment_count'
]
total_activity
+=
summary
[
'vote_count'
]
ratio
=
total_activity
.
to_f
/
total_users
.
to_f
puts
c
puts
"*********************"
puts
"Total Threads:
#{
summary
[
'thread_count'
]
}
"
...
...
@@ -124,7 +124,33 @@ namespace :kpis do
puts
"Average Engagement Per Engaging User:
#{
ratio
}
\n\n\n
"
end
end
task
:orphans
=>
:environment
do
#USAGE
#SINATRA_ENV=development rake kpis:oprhans
#or
#SINATRA_ENV=development bundle exec rake kpis:orphans
courses
=
Content
.
all
.
distinct
(
"course_id"
)
puts
"
\n\n
****************************************************"
puts
"thread reply rate per course on edX (
#{
Date
.
today
}
) "
puts
"********************************************************
\n\n
"
courses
.
each
do
|
c
|
#first, get all the users who have contributed
threads
=
Content
.
where
({
"course_id"
=>
c
,
"_type"
=>
"CommentThread"
})
orphans
=
Content
.
where
({
"course_id"
=>
c
,
"_type"
=>
"CommentThread"
,
"comment_count"
=>
0
})
ratio
=
oprhans
.
count
.
to_f
/
threads
.
to_f
puts
c
puts
"*********************"
puts
"Total Threads:
#{
threads
.
count
}
"
puts
"Total Orphaned Threads:
#{
orphans
.
count
}
"
if
threads
.
count
>
0
puts
"Orphan Ratio:
#{
ratio
}
"
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment