From fe4c9eaeac345c63e0c08c43b9dc3185d07716e8 Mon Sep 17 00:00:00 2001 From: Danail Dimitrov Date: Thu, 11 Mar 2021 21:09:47 +0200 Subject: Post rating shows current rating(not static number) --- .vs/DevHive-Angular/v16/.suo | Bin 23552 -> 32256 bytes .vs/VSWorkspaceState.json | 9 +++++++-- .vs/slnx.sqlite | Bin 155648 -> 167936 bytes src/app/components/post/post.component.ts | 2 +- src/models/post.ts | 11 ++++++++++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.vs/DevHive-Angular/v16/.suo b/.vs/DevHive-Angular/v16/.suo index 6166dc6..c5248df 100644 Binary files a/.vs/DevHive-Angular/v16/.suo and b/.vs/DevHive-Angular/v16/.suo differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index 5023c47..6e9e1ba 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -1,8 +1,13 @@ { "ExpandedNodes": [ "", - "\\src" + "\\e2e\\src", + "\\src", + "\\src\\app", + "\\src\\app\\components", + "\\src\\app\\components\\post", + "\\src\\app\\services" ], - "SelectedNode": "\\src\\main.ts", + "SelectedNode": "\\src\\app\\services\\rating.service.ts", "PreviewInSolutionExplorer": false } \ No newline at end of file diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index fb0acc2..d413bfa 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ 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; + } } -- cgit v1.2.3