Passed
Push — master ( d9ae97...694e2f )
by Dean
09:21 queued 06:02
created

SyncIdleDeferOption   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 21
ccs 11
cts 14
cp 0.7856
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A on_database_changed() 0 3 1
A on_plex_changed() 0 4 1
1 1
from plugin.preferences.options.core.base import SimpleOption
2
3
4 1
class SyncIdleDeferOption(SimpleOption):
5 1
    key = 'sync.idle_defer'
6 1
    type = 'boolean'
7
8 1
    default = True
9 1
    scope = 'server'
10
11 1
    group = ('Advanced', 'Sync - Triggers')
12 1
    label = 'Defer until server is idle'
13 1
    order = 130
14
15 1
    preference = 'sync_idle_defer'
16
17 1
    def on_database_changed(self, value, account=None):
18
        # Update preference
19
        return self._update_preference(value, account)
20
21 1
    def on_plex_changed(self, value, account=None):
22
        # Update database
23
        self.update(value, account, emit=False)
24
        return value
25