Skip to content
Open
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
65 changes: 65 additions & 0 deletions src/app/tutor-analytics/tutor-analytics.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
angular.module('doubtfire.tutor-analytics', [])

.directive 'tutorAnalytics', ->
restrict: 'E'
replace: true
templateUrl: 'tutor-analytics/tutor-analytics.tpl.html'

controller: ($scope) ->

# Mock student analytics data
$scope.students = [
{
name: 'John Smith'
completed: 8
pending: 2
engagement: 'High'
progress: 80
grade: 'HD'
}
{
name: 'Sarah Lee'
completed: 5
pending: 5
engagement: 'Medium'
progress: 50
grade: 'D'
}
{
name: 'Michael Brown'
completed: 3
pending: 7
engagement: 'Low'
progress: 30
grade: 'C'
}
{
name: 'Emma Wilson'
completed: 9
pending: 1
engagement: 'High'
progress: 90
grade: 'HD'
}
]

# Search model
$scope.searchText = ''

# Count total students
$scope.totalStudents = $scope.students.length

# Count at-risk students
$scope.atRiskCount = 0

angular.forEach $scope.students, (student) ->
if student.pending > 5
$scope.atRiskCount++

# Determine if student is at risk
$scope.isAtRisk = (student) ->
student.pending > 5

# Calculate average progress
totalProgress = 0
$scope.averageProgress = Math.round(totalProgress / $scope.students.length)
160 changes: 160 additions & 0 deletions src/app/tutor-analytics/tutor-analytics.tpl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<div class="container-fluid tutor-analytics-dashboard">

<div class="page-header">
<h2>Tutor Analytics Dashboard</h2>
</div>

<!-- Summary Cards -->
<div class="row">

<div class="col-md-4">
<div class="panel panel-primary">
<div class="panel-heading">
Total Students
</div>

<div class="panel-body text-center">
<h1>{{totalStudents}}</h1>
</div>
</div>
</div>

<div class="col-md-4">
<div class="panel panel-success">
<div class="panel-heading">
Average Progress
</div>

<div class="panel-body text-center">
<h1>{{averageProgress}}%</h1>
</div>
</div>
</div>

<div class="col-md-4">
<div class="panel panel-danger">
<div class="panel-heading">
At-Risk Students
</div>

<div class="panel-body text-center">
<h1>{{atRiskCount}}</h1>
</div>
</div>
</div>

</div>

<!-- Search -->
<div class="row">
<div class="col-md-12">

<div class="form-group">
<input
type="text"
class="form-control"
ng-model="searchText"
placeholder="Search students...">
</div>

</div>
</div>

<!-- Student Analytics Table -->
<div class="row">

<div class="col-md-12">

<div class="panel panel-default">

<div class="panel-heading">
Student Performance Analytics
</div>

<div class="panel-body">

<table class="table table-striped table-bordered">

<thead>
<tr>
<th>Student</th>
<th>Completed Tasks</th>
<th>Pending Tasks</th>
<th>Progress</th>
<th>Engagement</th>
<th>Grade</th>
<th>Status</th>
</tr>
</thead>

<tbody>

<tr ng-repeat="student in students | filter:searchText">

<td>{{student.name}}</td>

<td>
{{student.completed}}
</td>

<td>
{{student.pending}}
</td>

<td>

<div class="progress">
<div
class="progress-bar progress-bar-success"
role="progressbar"
aria-valuenow="{{student.progress}}"
aria-valuemin="0"
aria-valuemax="100"
style= "width: {{student.progress}}"

{{student.progress}}%
></div>/
</div>
</div>

</td>

<td>
{{student.engagement}}
</td>

<td>
{{student.grade}}
</td>

<td>

<span
ng-if="isAtRisk(student)"
class="label label-danger">
At Risk
</span>

<span
ng-if="!isAtRisk(student)"
class="label label-success">
On Track
</span>

</td>

</tr>

</tbody>

</table>

</div>

</div>

</div>

</div>

</div>