diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-11 21:09:47 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-11 21:09:47 +0200 |
| commit | fe4c9eaeac345c63e0c08c43b9dc3185d07716e8 (patch) | |
| tree | f0b884e19a5a44357197ed6951e7d2ef3d5f01d7 /src | |
| parent | 1f008dfc777022582e5e0cf0823175e66c2790cf (diff) | |
| download | DevHive-Angular-fe4c9eaeac345c63e0c08c43b9dc3185d07716e8.tar DevHive-Angular-fe4c9eaeac345c63e0c08c43b9dc3185d07716e8.tar.gz DevHive-Angular-fe4c9eaeac345c63e0c08c43b9dc3185d07716e8.zip | |
Post rating shows current rating(not static number)
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/components/post/post.component.ts | 2 | ||||
| -rw-r--r-- | src/models/post.ts | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/app/components/post/post.component.ts b/src/app/components/post/post.component.ts index 39391ad..f813d8c 100644 --- a/src/app/components/post/post.component.ts +++ b/src/app/components/post/post.component.ts @@ -31,7 +31,7 @@ export class PostComponent implements OnInit { (result: object) => { Object.assign(this.post, result); this.post.fileURLs = Object.values(result)[7]; - this.votesNumber = 23; + this.votesNumber = this.post.currentRating; this.timeCreated = new Date(this.post.timeCreated).toLocaleString('en-GB'); this.loadUser(); diff --git a/src/models/post.ts b/src/models/post.ts index 8e58bea..8c1890a 100644 --- a/src/models/post.ts +++ b/src/models/post.ts @@ -11,8 +11,9 @@ export class Post { private _timeCreated: Date; private _comments: PostComment[]; private _fileURLs: string[]; + private _currentRating: number; - constructor(postId: Guid, creatorFirstName: string, creatorLastName: string, creatorUsername: string, message: string, timeCreated: Date, comments: PostComment[], fileURLs: string[]) { + constructor(postId: Guid, creatorFirstName: string, creatorLastName: string, creatorUsername: string, message: string, timeCreated: Date, comments: PostComment[], fileURLs: string[], currentRating: number) { this.postId = postId; this.creatorFirstName = creatorFirstName; this.creatorLastName = creatorLastName; @@ -21,6 +22,7 @@ export class Post { this.timeCreated = timeCreated; this.comments = comments; this.fileURLs = fileURLs; + this.currentRating = currentRating; } public get postId(): Guid { @@ -78,4 +80,11 @@ export class Post { public set fileURLs(v: string[]) { this._fileURLs = v; } + + public get currentRating(): number { + return this._currentRating; + } + public set currentRating(v: number) { + this._currentRating = v; + } } |
