[O] Make AnalyzedRating a class

This commit is contained in:
Hykilpikonna
2020-04-27 17:16:01 -04:00
parent 38232c3182
commit 71dcf9e8c1
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -125,9 +125,15 @@ export class CourseInfoRating
} }
} }
export interface AnalyzedRating export class AnalyzedRating
{ {
ratingCounts: number[][] ratingCounts: number[][]
ratingSums: number[] ratingSums: number[]
totalCount: number totalCount: number
constructor(json: any)
{
this.ratingCounts = json.ratingCounts;
this.ratingSums = json.ratingSums;
this.totalCount = json.totalCount;
}
} }
@@ -45,7 +45,7 @@
if (result.success) if (result.success)
{ {
// Assign rating // Assign rating
c.rating = result.data as AnalyzedRating; c.rating = new AnalyzedRating(result.data);
} }
else else
{ {