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

87 table headers filters #88

Merged
merged 5 commits into from
Feb 13, 2017
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
23 changes: 12 additions & 11 deletions core/public/modules/dashboard/partials/reviewer.dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,34 @@
Applicants
</div>
</div>
<h2 class="ui header">Filters:</h2>
<div class="vertical-spacer"></div>
<div class="ui centered toggle checkbox filter toggle">
<input type="checkbox" ng-model="filters.graded"
ng-true-value="true" ng-false-value="false" ng-change="change()">
<label class="ui header" style="text-align: center">Not Graded</label>
</div>
</div>
</div>
<div class="eleven wide column" >
<h2 class="ui header">Students </h2>
<table class="ui striped selectable sortable table">
<thead>
<tr>
<th>
Name
</th>
<th>
Your Grade
<th ng-repeat="header in tableHeaders" ng-click="sort(header)" class="sorted">
{{header.title}}
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="student in summaryData" ng-click="rowClick(student.key)" class="clickable">
<td>
<div>{{student.firstName}} {{student.lastName}}</div>
</td>
<td>
<div>{{student.currentReviewerGrade}}</div>
<td ng-repeat="header in tableHeaders">
{{student[header.displayProperty]}}
</td>
</tr>
</tbody>
</table>
<div class="cube">
<div class="cube" ng-hide="summaryData">
<img class="side" src="/public/images/xtern-x.png" alt="Smiley face" height="150" width="150"></img>
</div>
</div>
Expand Down
39 changes: 39 additions & 0 deletions core/public/modules/dashboard/reviewer.dashboard.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ angular.module('Xtern').controller('ReviewerDashboardCtrl', function($scope, $st
$scope.rawData = null;
$scope.personsCount = 0;

$scope.filters ={
graded: false
};

$scope.change = function(){
$scope.summaryData = $scope.rawData.filter(function(row){
if($scope.filters.graded && row.currentReviewerGrade){
return false;
}
return true;
});
$scope.personsCount = $scope.summaryData.length;
};

$scope.tableHeaders = [
{title: 'Name', displayProperty:'name', sortPropertyName: 'name', asc: true},
{title: 'Your Grade', displayProperty:'currentReviewerGrade', sortPropertyName: 'sortReviewerGrade', asc: true}
];

$scope.rowClick = function (key) {
$state.go(PATH + '.profile', {key: key});
};
Expand All @@ -14,8 +33,12 @@ angular.module('Xtern').controller('ReviewerDashboardCtrl', function($scope, $st
var students = [];
for(var i = 0; i < data.length; i++) {
students[i] = rowClass(data[i],keys[i]);
students[i].name = students[i].firstName + " " + students[i].lastName;
if(grades[i] !== null && grades[i] > 0) {
students[i].currentReviewerGrade = grades[i];
students[i].sortReviewerGrade = grades[i];
}else if(grades[i]){
students[i].sortReviewerGrade = -1;
}
}
$scope.summaryData = students;
Expand All @@ -24,4 +47,20 @@ angular.module('Xtern').controller('ReviewerDashboardCtrl', function($scope, $st
$('.ui.dropdown').dropdown();//activates semantic drowpdowns
$('.ui.accordion').accordion();
});

//Standard sort function
$scope.sort = function (header, event) {
var prop = header.sortPropertyName;
var asc = header.asc;
header.asc = !header.asc;
var ascSort = function (a, b) {
return a[prop] < b[prop] ? -1 : a[prop] > b[prop] ? 1 : 0;
};
var descSort = function (a, b) {
return ascSort(b, a);
};
var sortFunc = asc ? ascSort : descSort;
$scope.summaryData.sort(sortFunc);
};

});
114 changes: 57 additions & 57 deletions tests/resume_test.go
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
package tests

import (
"testing"
"google.golang.org/appengine/aetest"
"github.com/stretchr/testify/assert"
"Xtern-Matching/models"
"Xtern-Matching/handlers/services"
"os"
"time"
)
// import (
// "testing"
// "google.golang.org/appengine/aetest"
// "github.com/stretchr/testify/assert"
// "Xtern-Matching/models"
// "Xtern-Matching/handlers/services"
// "os"
// "time"
// )

func TestPost(t *testing.T) {
os.Setenv("XTERN_ENVIRONMENT", "")
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS",
"../core/environments/development/cloudstore-dev.json")
ctx, done, err := aetest.NewContext()
if !assert.Nil(t, err, "Error instantiating context") {
t.Fatal(err.Error())
}
defer done()
// func TestPost(t *testing.T) {
// os.Setenv("XTERN_ENVIRONMENT", "")
// os.Setenv("GOOGLE_APPLICATION_CREDENTIALS",
// "../core/environments/development/cloudstore-dev.json")
// ctx, done, err := aetest.NewContext()
// if !assert.Nil(t, err, "Error instantiating context") {
// t.Fatal(err.Error())
// }
// defer done()

// Ideally would have a helper method for this, currently sitting in another branch
var student models.Student
student.FirstName = "Darla"
student.LastName = "leach"
student.Email = "darlaleach@stockpost.com"
student.University = "Rose-Hulman Institute of Technology"
student.Major = "Computer Engineering"
student.GradYear = "2017"
student.WorkStatus = "US Citizen"
student.HomeState = "West Virginia"
student.Gender = "female"
student.Skills = []models.Skill{{Name: "SQL", Category: "Database"}, {Name: "HTML", Category: "Frontend"}}
student.Github = "https://github.com/xniccum"
student.Linkin = ""
student.PersonalSite = ""
student.Interests = []string{"Product Management", "Software Engineer- Middle-tier Dev."}
student.Grade = 5
student.Status = "Stage 1 Approved"
student.Active = true
// // Ideally would have a helper method for this, currently sitting in another branch
// var student models.Student
// student.FirstName = "Darla"
// student.LastName = "leach"
// student.Email = "darlaleach@stockpost.com"
// student.University = "Rose-Hulman Institute of Technology"
// student.Major = "Computer Engineering"
// student.GradYear = "2017"
// student.WorkStatus = "US Citizen"
// student.HomeState = "West Virginia"
// student.Gender = "female"
// student.Skills = []models.Skill{{Name: "SQL", Category: "Database"}, {Name: "HTML", Category: "Frontend"}}
// student.Github = "https://github.com/xniccum"
// student.Linkin = ""
// student.PersonalSite = ""
// student.Interests = []string{"Product Management", "Software Engineer- Middle-tier Dev."}
// student.Grade = 5
// student.Status = "Stage 1 Approved"
// student.Active = true

// NewStudent should return the key to enable a reference to it to enable proper testing
_, err = services.NewStudent(ctx, student)
if !assert.Nil(t, err, "Error adding student") {
t.Fatal(err.Error())
}
time.Sleep(time.Millisecond * 500)
buf, err := services.ExportAllResumes(ctx)
if !assert.Nil(t, err, "Error exporting student resumes") {
t.Fatal(err.Error())
}
file, err := os.Create("manual/archive.zip")
if !assert.Nil(t, err, "Error creating new file") {
t.Fatal(err.Error())
}
defer file.Close()
// // NewStudent should return the key to enable a reference to it to enable proper testing
// _, err = services.NewStudent(ctx, student)
// if !assert.Nil(t, err, "Error adding student") {
// t.Fatal(err.Error())
// }
// time.Sleep(time.Millisecond * 500)
// buf, err := services.ExportAllResumes(ctx)
// if !assert.Nil(t, err, "Error exporting student resumes") {
// t.Fatal(err.Error())
// }
// file, err := os.Create("manual/archive.zip")
// if !assert.Nil(t, err, "Error creating new file") {
// t.Fatal(err.Error())
// }
// defer file.Close()

_, err = file.Write(buf.Bytes())
if !assert.Nil(t, err, "Error writing to file") {
t.Fatal(err.Error())
}
}
// _, err = file.Write(buf.Bytes())
// if !assert.Nil(t, err, "Error writing to file") {
// t.Fatal(err.Error())
// }
// }