Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lab-241
appbase
Commits
fa2e9b69
Commit
fa2e9b69
authored
May 05, 2016
by
mikamboo
Browse files
TG-21 #in-progress : Fix js lint issues [ci skip]
parent
62017851
Changes
1
Hide whitespace changes
Inline
Side-by-side
api/common/models/shop.js
View file @
fa2e9b69
...
...
@@ -49,10 +49,12 @@ module.exports = function(Shop) {
Shop
.
unrate
=
function
(
shopId
,
rating
,
cb
)
{
Shop
.
findById
(
shopId
,
function
(
err
,
instance
){
var
response
=
{};
if
(
!
instance
.
globalNote
||
!
instance
.
nbReviews
||
instance
.
globalNote
==
0
||
instance
.
nbReviews
==
0
||
(
instance
.
nbReviews
==
1
&&
instance
.
globalNote
!=
rating
)
){
cb
(
"
Unconsistent data
"
,
null
);
if
(
!
instance
.
globalNote
||
!
instance
.
nbReviews
||
instance
.
globalNote
===
0
||
instance
.
nbReviews
===
0
||
(
instance
.
nbReviews
===
1
&&
instance
.
globalNote
!==
rating
)
){
cb
(
'
Unconsistent data
'
,
null
);
}
else
{
instance
.
globalNote
=
((
instance
.
nbReviews
*
instance
.
globalNote
)
-
rating
)
/
(
instance
.
nbReviews
-
1
);
instance
.
globalNote
=
((
instance
.
nbReviews
*
instance
.
globalNote
)
-
rating
)
/
(
instance
.
nbReviews
-
1
);
instance
.
nbReviews
--
;
instance
.
save
().
then
(
function
(){
response
.
globalNote
=
instance
.
globalNote
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment