Skip to content
Snippets Groups Projects
Commit 8226641f authored by Titus Netland's avatar Titus Netland
Browse files

Average user rating service added

parent f318eab4
No related branches found
No related tags found
1 merge request!97Average user service
......@@ -106,7 +106,8 @@
<script>
import RatingComponent from "@/components/UserProfileComponents/Rating.vue";
import { parseCurrentUser } from "@/utils/token-utils";
import { getUser, getAverageRating } from "@/utils/apiutil";
import { getUser} from "@/utils/apiutil";
import UserService from "@/services/user.service"
export default {
name: "LargeProfileCard",
......@@ -135,10 +136,14 @@ export default {
return;
}
this.user = await getUser(this.id);
let rating = await getAverageRating(this.id);
if (rating >= 0 && rating <= 5) {
this.renterRating = rating;
this.ownerRating = rating;
let ratingAsOwner = await UserService.getUserRatingAsOwner(this.id);
let ratingAsRenter = await UserService.getUserRatingAsRenter(this.id)
if (ratingAsOwner >= 0 && ratingAsOwner <= 5) {
this.ownerRating = ratingAsOwner;
}
if (ratingAsRenter >= 0 && ratingAsRenter <= 5){
this.renterRating = ratingAsRenter;
}
},
getProfilePicture() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment