Compare commits

...

15 Commits

Author SHA1 Message Date
Hykilpikonna 8dd7d35abe [U] Pre-release v0.1.2.236 2019-09-28 17:38:33 -04:00
Hykilpikonna 2b989fb137 [-] Remove placeholder button 2019-09-28 17:35:55 -04:00
Hykilpikonna e2a13e90e0 [O] Optimize font size for max gpa 2019-09-28 17:35:46 -04:00
Hykilpikonna 3546a57711 [O] Use class to add style to card 2019-09-28 17:35:17 -04:00
Hykilpikonna 770e26b0cf [F] Fix warning: " should be ' 2019-09-28 16:33:00 -04:00
Hykilpikonna fff60f5754 [F] Fix the newline display for button 2019-09-27 20:12:41 -04:00
Hykilpikonna a46e011c90 [O] Use css to produce new-line effect instead of <br> 2019-09-27 16:47:22 -04:00
Hykilpikonna 48224d9e34 [O] Optimize jsdocs 2019-09-27 16:40:59 -04:00
Hykilpikonna eb311e9f2d [+] Display the maximum GPA 2019-09-27 16:38:52 -04:00
Hykilpikonna 7b53e65a1b [O] Return raw GPA in overall 2019-09-27 16:38:39 -04:00
Hykilpikonna 065d6d31a3 [O] Hit enter to login 2019-09-27 16:38:26 -04:00
Hykilpikonna d8eb160123 [F] Fix max gpa calculation 2019-09-27 16:33:50 -04:00
Hykilpikonna 8e924d8e33 [+] Also calculate max gpa when calculating gpa 2019-09-24 22:22:18 -04:00
Hykilpikonna 1e45b418b8 [O] Encapsulate getGP() with letter grade passed in 2019-09-24 22:20:58 -04:00
Hykilpikonna e42c8be76f [O] Detect letter grade for presence instead of numeric grade 2019-09-24 22:19:48 -04:00
7 changed files with 61 additions and 25 deletions
+9
View File
@@ -4,6 +4,7 @@ import {HttpUtils} from '@/utils/http-utils';
/** /**
* This component handles user login, and obtains data from the server. * This component handles user login, and obtains data from the server.
* TODO: Press enter to login
*/ */
@Component({ @Component({
components: {}, components: {},
@@ -70,4 +71,12 @@ export default class Login extends Vue
this.loading = false; this.loading = false;
}); });
} }
/**
* This is called when the user hits enter in the input boxes.
*/
public onEnter()
{
this.onLoginClick();
}
} }
+4 -2
View File
@@ -8,13 +8,15 @@
<el-input v-model="username" <el-input v-model="username"
placeholder="School Username" placeholder="School Username"
:class="{'input-error': error !== ''}"> :class="{'input-error': error !== ''}"
@keyup.enter.native="onEnter">
</el-input> </el-input>
<el-input v-model="password" <el-input v-model="password"
placeholder="Veracross Password" placeholder="Veracross Password"
show-password="" show-password=""
:class="{'input-error': error !== ''}"> :class="{'input-error': error !== ''}"
@keyup.enter.native="onEnter">
</el-input> </el-input>
<div class="el-form-item__error custom">{{error}}</div> <div class="el-form-item__error custom">{{error}}</div>
+1 -1
View File
@@ -13,5 +13,5 @@ export default class Constants
'| |. , |---|,---.,---.| , .,---,,---.,---.\n' + '| |. , |---|,---.,---.| , .,---,,---.,---.\n' +
' \\ / >< | || |,---|| | | .-\' |---\'| \n' + ' \\ / >< | || |,---|| | | .-\' |---\'| \n' +
' `\' \' ` ` \'` \'`---^`---\'`---|\'---\'`---\'` \n' + ' `\' \' ` ` \'` \'`---^`---\'`---|\'---\'`---\'` \n' +
' v0.1.1.0 `---\' ' ' v0.1.2.236 `---\' '
} }
+23 -4
View File
@@ -12,18 +12,37 @@
flex-direction: column; flex-direction: column;
} }
.span-gpa-header .gpa-card
{
margin-left: 20px;
min-width: 136px;
}
.gpa
{
display: block;
}
.gpa.header
{ {
font-size: 14px; font-size: 14px;
} }
.span-gpa .gpa.text
{ {
font-size: 35px; font-size: 35px;
font-family: 'Avenir', Helvetica, Arial, sans-serif; font-family: 'Avenir', Helvetica, Arial, sans-serif;
} }
.gpa-time .gpa.max
{ {
font-size: 14px; margin-top: -10px;
margin-bottom: 10px;
font-size: 12px;
color: #409eff;
}
.gpa.time
{
font-size: 11px;
} }
+7 -3
View File
@@ -11,6 +11,9 @@ export default class Overall extends Vue
// @ts-ignore // @ts-ignore
@Prop({required: true}) courses: Course[]; @Prop({required: true}) courses: Course[];
/**
* Convert assignments list to a graph dataset.
*/
get convertCharts() get convertCharts()
{ {
// Null case // Null case
@@ -133,12 +136,13 @@ export default class Overall extends Vue
} }
/** /**
* This function is called to get gpa as a string. * This function is called to get gpa since I can't import another
* class in the Vue file.
*/ */
public getGPA() public getGPA()
{ {
let gpa = GPAUtils.getGPA(this.courses); let gpa = GPAUtils.getGPA(this.courses);
let result = '' + gpa.gpa; // let result = '' + gpa.gpa;
/* Not accurate /* Not accurate
if (!gpa.accurate) if (!gpa.accurate)
@@ -146,6 +150,6 @@ export default class Overall extends Vue
result = `(${result})`; result = `(${result})`;
}*/ }*/
return result; return gpa;
} }
} }
+6 -8
View File
@@ -2,15 +2,13 @@
<div id="overall"> <div id="overall">
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-card style="margin-left: 20px"> <el-card class="gpa-card">
<div style="padding: 14px;"> <div style="padding: 14px;">
<span class="span-gpa-header">GPA:</span> <span class="gpa header">GPA:</span>
<br> <span class="gpa text">{{getGPA().gpa}}</span>
<span class="span-gpa">{{getGPA()}}</span> <span class="gpa max">(Out of {{getGPA().max}})</span>
<div class="bottom clearfix gpa-time"> <div class="bottom clearfix gpa time">
<time class="time">{{ new Date().toDateString() }}</time> <time>{{ new Date().toDateString() }}</time>
<br>
<el-button type="text" class="button">Button</el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
+11 -7
View File
@@ -31,7 +31,7 @@ export class GPAUtils
* *
* @param coursesOriginal List of courses * @param coursesOriginal List of courses
*/ */
public static getGPA(coursesOriginal: Course[]): {gpa: number, accurate: boolean} public static getGPA(coursesOriginal: Course[]): {gpa: number, accurate: boolean, max: number}
{ {
// Clone array // Clone array
let courses: Course[] = []; let courses: Course[] = [];
@@ -42,7 +42,7 @@ export class GPAUtils
// Remove all courses that does not have a grade // Remove all courses that does not have a grade
coursesOriginal.forEach(course => coursesOriginal.forEach(course =>
{ {
if (course.numericGrade == null || course.numericGrade == 0) if (course.letterGrade == null || course.letterGrade == '')
{ {
accurate = false; accurate = false;
} }
@@ -55,35 +55,39 @@ export class GPAUtils
// If no course have grade, return -1 // If no course have grade, return -1
if (courses.length == 0) if (courses.length == 0)
{ {
return {gpa: -1, accurate: false}; return {gpa: -1, accurate: false, max: -1};
} }
// Count total GPA // Count total GPA
let totalGPA = 0; let totalGPA = 0;
let maxTotal = 0;
courses.forEach(course => courses.forEach(course =>
{ {
totalGPA += this.getGP(course); totalGPA += this.getGP(course, course.letterGrade);
maxTotal += this.getGP(course, 'A+');
}); });
// Get average GPA, round to two decimal places // Get average GPA, round to two decimal places
let gpa = Math.round(totalGPA / courses.length * 100) / 100; let gpa = Math.round(totalGPA / courses.length * 100) / 100;
let maxGPA = Math.round(maxTotal / courses.length * 100) / 100;
// Return results // Return results
return {gpa: gpa, accurate: accurate}; return {gpa: gpa, accurate: accurate, max: maxGPA};
} }
/** /**
* Calculate GPA for a course * Calculate GPA for a course
* *
* @param course Course * @param course Course
* @param letterGrade Letter grade
*/ */
public static getGP(course: Course): number public static getGP(course: Course, letterGrade?: string): number
{ {
// Find the GPA for this course. // Find the GPA for this course.
for (let scale of this.SCALE) for (let scale of this.SCALE)
{ {
// Letter grades are the same // Letter grades are the same
if (scale[this.LETTER] == course.letterGrade) if (scale[this.LETTER] == letterGrade)
{ {
// Get grade and add it // Get grade and add it
let grade = <number> scale[this.GPA]; let grade = <number> scale[this.GPA];