-
Notifications
You must be signed in to change notification settings - Fork 348
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
Migrate:grade task modal #564
Changes from 56 commits
80348b4
646d860
7ddf0c1
cbffcdf
e7059c7
9d37660
a0d3122
5cea7b6
048e3f9
eb743d8
83cc377
3965e82
f21ef4a
9b51b83
f44f6d1
44b1172
64b2cb2
75ea3f2
9951f05
629649a
432de28
cc49268
f60fdda
3a9f15d
b5cda5e
528e543
5484df0
526a957
ded3377
3a28de2
efc33e7
7d5906e
a399698
7c24000
5f921b0
bcbd4e1
0531c37
e24df85
da5d9fa
83c8d6e
729915b
026af08
0fc9b54
603e738
873a859
d525750
845cd08
2e4dde8
72db500
d8b4305
dc6bf5f
03429c8
9e9fccc
63c11d1
a61ec9b
f5960e8
b33c516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<span class="grade-icon"> | ||
{{ gradeLetter }} | ||
</span> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.grade-icon { | ||
color: #fff; | ||
font-size: 1em; | ||
border-radius: 100%; | ||
width: 2.25em; | ||
height: 2.25em; | ||
font-weight: 100; | ||
margin: 0 auto; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: #333333; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { GradeIconComponent } from './grade-icon.component'; | ||
import { gradeService } from 'src/app/ajs-upgraded-providers'; | ||
|
||
describe('GradeIconComponent', () => { | ||
let component: GradeIconComponent; | ||
let fixture: ComponentFixture<GradeIconComponent>; | ||
let gradeServiceStub: jasmine.SpyObj<any>; | ||
|
||
beforeEach( | ||
waitForAsync(() => { | ||
gradeServiceStub = { | ||
grades: ['Pass', 'Credit', 'Distinction', 'High Distinction'], | ||
gradeAcronyms: { | ||
Fail: 'F', | ||
Pass: 'P', | ||
Credit: 'C', | ||
Distinction: 'D', | ||
'High Distinction': 'HD', | ||
0: 'P', | ||
1: 'C', | ||
2: 'D', | ||
3: 'HD', | ||
}, | ||
}; | ||
|
||
gradeServiceStub.grades[-1] = 'Fail'; | ||
gradeServiceStub.gradeAcronyms[-1] = 'F'; | ||
|
||
TestBed.configureTestingModule({ | ||
declarations: [GradeIconComponent], | ||
providers: [{ provide: gradeService, useValue: gradeServiceStub }], | ||
}).compileComponents(); | ||
}) | ||
); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(GradeIconComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should set the index value when undefined', () => { | ||
component.index = undefined; | ||
component.ngOnInit(); | ||
|
||
expect(component.index).toEqual(-1); | ||
}); | ||
|
||
it('should set the grade to Fail when given invalid input', () => { | ||
component.index = undefined; | ||
component.grade = 'Tomato'; | ||
component.ngOnInit(); | ||
|
||
expect(component.index).toEqual(-1); | ||
expect(component.gradeText).toEqual('Fail'); | ||
expect(component.gradeLetter).toEqual('F'); | ||
}); | ||
|
||
it('should appropriate set the grade when passed a grade value', () => { | ||
gradeServiceStub.grades.forEach((grade: string) => { | ||
component.grade = grade; | ||
component.index = undefined; | ||
component.ngOnInit(); | ||
|
||
expect(component.index).toEqual(gradeServiceStub.grades.indexOf(grade)); | ||
expect(component.gradeText).toEqual(grade); | ||
expect(component.gradeLetter).toEqual(gradeServiceStub.gradeAcronyms[grade]); | ||
}); | ||
}); | ||
|
||
it('should appropriate set the grade when passed a grade index', () => { | ||
gradeServiceStub.grades.forEach((_, index: number) => { | ||
component.index = index - 1; | ||
component.ngOnInit(); | ||
|
||
expect(component.index).toEqual(index - 1); | ||
expect(component.gradeText).toEqual(gradeServiceStub.grades[component.index]); | ||
expect(component.gradeLetter).toEqual(gradeServiceStub.gradeAcronyms[component.gradeText]); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component, OnInit, Input, Inject } from '@angular/core'; | ||
import { gradeService } from 'src/app/ajs-upgraded-providers'; | ||
|
||
@Component({ | ||
selector: 'grade-icon', | ||
templateUrl: 'grade-icon.component.html', | ||
styleUrls: ['grade-icon.component.scss'], | ||
}) | ||
export class GradeIconComponent implements OnInit { | ||
@Input() grade: string = 'F'; | ||
@Input() index: number; | ||
|
||
gradeText: string; | ||
gradeLetter: string; | ||
|
||
constructor(@Inject(gradeService) private GradeService: any) {} | ||
|
||
ngOnInit(): void { | ||
if (this.index == undefined) { | ||
this.index = this.GradeService.grades.indexOf(this.grade); | ||
} | ||
this.gradeText = this.GradeService.grades[this.index]; | ||
this.gradeLetter = this.GradeService.gradeAcronyms[this.gradeText]; | ||
} | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,29 +8,29 @@ | |
</tr> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="contrib in team.memberContributions | orderBy:memberSortOrder:reverse"> | ||
<td>{{contrib.project.student.name}}</td> | ||
<tr ng-repeat="member in team.members | orderBy:memberSortOrder:reverse"> | ||
<td>{{member.student_name}}</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesn't look right - with the new service we do not have any snake case properties There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check everything in this... |
||
<td class="text-left"> | ||
<grade-icon grade="contrib.project.targetGrade"></grade-icon> | ||
<grade-icon [index]="member.targetGrade"></grade-icon> | ||
</td> | ||
<td> | ||
<rating | ||
class="group-member-contribution-rating" | ||
ng-click="checkClearRating(contrib)" | ||
ng-model="contrib.rating" | ||
on-hover="hoveringOver(contrib, value)" | ||
on-leave="hoveringOver(contrib, null)" | ||
ng-click="checkClearRating(member)" | ||
ng-model="member.rating" | ||
on-hover="hoveringOver(member, value)" | ||
on-leave="hoveringOver(member, null)" | ||
max="numStars" | ||
state-on="'fa fa-child rating-outline'" | ||
state-off="'fa fa-child rating-disabled'"> | ||
</rating> | ||
<span | ||
class="label {{percentClass(contrib.percent)}}" | ||
ng-show="contrib.overStar"> | ||
<span ng-show="contrib.percent > 0"> | ||
{{contrib.percent}} % effort | ||
class="label {{percentClass(member.percent)}}" | ||
ng-show="member.overStar"> | ||
<span ng-show="member.percent > 0"> | ||
{{member.percent}} % effort | ||
</span> | ||
<span ng-hide="contrib.percent > 0"> | ||
<span ng-hide="member.percent > 0"> | ||
No effort | ||
</span> | ||
</span> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be a new equivalent of this in typescript.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if you can remove the GradeService from this and use the new code