Completed
Push — master ( b6dd21...9691ed )
by Raúl
14s queued 11s
created

views/js/simulator.js   A

Complexity

Total Complexity 5
Complexity/F 2.5

Size

Lines of Code 23
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 0
wmc 5
eloc 14
c 2
b 0
f 0
nc 1
mnd 2
bc 6
fnc 2
dl 0
loc 23
rs 10
bpm 3
cpm 2.5
noi 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A simulator.js ➔ findQuantitySelector 0 8 2
1
/**
2
* This file is part of the official Paga+Tarde module for PrestaShop.
3
*
4
* @author    Paga+Tarde <[email protected]>
5
* @copyright 2015-2016 Paga+Tarde
6
* @license   proprietary
7
*/
8
function findPriceSelector()
9
{
10
    var priceDOM = document.getElementById("our_price_display");
11
    if (priceDOM != null) {
0 ignored issues
show
Best Practice introduced by
Comparing priceDOM to null using the != operator is not safe. Consider using !== instead.
Loading history...
12
        return '#our_price_display';
13
    } else {
0 ignored issues
show
Comprehensibility introduced by
else is not necessary here since all if branches return, consider removing it to reduce nesting and make code more readable.
Loading history...
14
        priceDOM = document.querySelector(".current-price span[itemprop=price]")
15
        if (priceDOM != null) {
16
            return ".current-price span[itemprop=price]";
17
        }
18
    }
19
20
    return 'default';
21
}
22
23
function findQuantitySelector()
24
{
25
    var quantityDOM = document.getElementById("quantity_wanted");
26
    if (quantityDOM != null) {
0 ignored issues
show
Best Practice introduced by
Comparing quantityDOM to null using the != operator is not safe. Consider using !== instead.
Loading history...
27
        return '#quantity_wanted';
28
    }
29
    return 'default';
30
}