Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
e3f327ae
Commit
e3f327ae
authored
3 years ago
by
Håkon Eilertsen Røskaft
Browse files
Options
Downloads
Patches
Plain Diff
Fixed so rating now displayes properly on user profile
parent
57c6d025
No related branches found
Branches containing commit
No related tags found
1 merge request
!157
Rating load
Pipeline
#182404
passed
3 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/UserProfileComponents/UserProfile.vue
+7
-7
7 additions, 7 deletions
src/components/UserProfileComponents/UserProfile.vue
src/services/user.service.js
+22
-0
22 additions, 0 deletions
src/services/user.service.js
with
29 additions
and
7 deletions
src/components/UserProfileComponents/UserProfile.vue
+
7
−
7
View file @
e3f327ae
...
...
@@ -95,7 +95,7 @@
</h5>
<div>
<rating-component
:rating=
"renterRating"
:ratingType=
"'Leietaker'"
/>
<
r
ating
-c
omponent
:rating=
"ownerRating"
:ratingType=
"'Utleier'"
/>
<
R
ating
C
omponent
:rating=
"ownerRating"
:ratingType=
"'Utleier'"
></RatingComponent>
</div>
<div
...
...
@@ -161,11 +161,11 @@ export default {
this
.
isCurrentUser
=
true
;
this
.
user
=
this
.
currentUser
;
this
.
user
=
await
UserService
.
getUserFromId
(
this
.
user
.
accountId
);
return
;
}
else
{
this
.
user
=
await
getUser
(
this
.
id
);
}
this
.
user
=
await
getUser
(
this
.
id
);
let
ratingAsOwner
=
await
UserService
.
getUserRatingAsOwner
(
this
.
id
);
let
ratingAsRenter
=
await
UserService
.
getUserRatingAsRenter
(
this
.
id
);
let
ratingAsOwner
=
await
UserService
.
getUserRatingAverageOwner
(
this
.
id
);
let
ratingAsRenter
=
await
UserService
.
getUserRatingAverageRenter
(
this
.
id
);
if
(
ratingAsOwner
>=
0
&&
ratingAsOwner
<=
5
)
{
this
.
ownerRating
=
ratingAsOwner
;
...
...
@@ -186,8 +186,8 @@ export default {
this
.
logout
();
},
},
beforeMount
()
{
this
.
getUser
();
async
beforeMount
()
{
await
this
.
getUser
();
},
};
</
script
>
This diff is collapsed.
Click to expand it.
src/services/user.service.js
+
22
−
0
View file @
e3f327ae
...
...
@@ -39,6 +39,28 @@ class UserService {
.
catch
((
err
)
=>
console
.
error
(
err
));
}
async
getUserRatingAverageOwner
(
userId
)
{
return
await
axios
.
get
(
API_URL
+
"
rating/
"
+
userId
+
"
/average/owner
"
,
{
headers
:
tokenHeader
(),
})
.
then
((
res
)
=>
{
return
res
.
data
;
})
.
catch
((
err
)
=>
console
.
error
(
err
));
}
async
getUserRatingAverageRenter
(
userId
)
{
return
await
axios
.
get
(
API_URL
+
"
rating/
"
+
userId
+
"
/average/renter
"
,
{
headers
:
tokenHeader
(),
})
.
then
((
res
)
=>
{
return
res
.
data
;
})
.
catch
((
err
)
=>
console
.
error
(
err
));
}
async
setListingToDeleted
(
listingId
)
{
return
await
axios
.
delete
(
API_URL
+
"
listing/
"
+
listingId
,
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment