[O] Make AnalyzedRating a class
This commit is contained in:
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user