diff --git a/changedetectionio/blueprint/tags/__init__.py b/changedetectionio/blueprint/tags/__init__.py
index 2c18d192d..4b6d40ca8 100644
--- a/changedetectionio/blueprint/tags/__init__.py
+++ b/changedetectionio/blueprint/tags/__init__.py
@@ -132,6 +132,7 @@ def construct_blueprint(datastore: ChangeDetectionStore):
"""
diff --git a/changedetectionio/processors/restock_diff/__init__.py b/changedetectionio/processors/restock_diff/__init__.py
index 785668be0..b02189069 100644
--- a/changedetectionio/processors/restock_diff/__init__.py
+++ b/changedetectionio/processors/restock_diff/__init__.py
@@ -60,7 +60,8 @@ class Watch(BaseWatch):
self['restock'] = Restock(kw['default']['restock']) if kw.get('default') and kw['default'].get('restock') else Restock()
self['restock_settings'] = kw['default']['restock_settings'] if kw.get('default',{}).get('restock_settings') else {
- 'follow_price_changes': True
+ 'follow_price_changes': True,
+ 'in_stock_processing' : 'in_stock_only'
}
def clear_watch(self):
diff --git a/changedetectionio/processors/restock_diff/forms.py b/changedetectionio/processors/restock_diff/forms.py
index 825edff3f..efa66f3cb 100644
--- a/changedetectionio/processors/restock_diff/forms.py
+++ b/changedetectionio/processors/restock_diff/forms.py
@@ -1,19 +1,26 @@
-
from wtforms import (
BooleanField,
validators,
FloatField
)
+from wtforms.fields.choices import RadioField
from wtforms.fields.form import FormField
from wtforms.form import Form
+from wtforms.validators import ValidationError
from changedetectionio.forms import processor_text_json_diff_form
+
+
class RestockSettingsForm(Form):
-# Could be both, "in_stock_only" either
- in_stock_only = BooleanField('Only trigger when product goes BACK to in-stock', default=True)
- price_change_min = FloatField('Minimum amount to trigger notification', [validators.Optional()],
+ in_stock_processing = RadioField(label='Re-stock detection', choices=[
+ ('in_stock_only', "In Stock only (Out Of Stock -> In Stock only)"),
+ ('all_changes', "Any availability changes"),
+ ('off', "Off, don't follow availability/restock"),
+ ], default="in_stock_only")
+
+ price_change_min = FloatField('Below price to trigger notification', [validators.Optional()],
render_kw={"placeholder": "No limit", "size": "10"})
- price_change_max = FloatField('Maximum amount to trigger notification', [validators.Optional()],
+ price_change_max = FloatField('Above price to trigger notification', [validators.Optional()],
render_kw={"placeholder": "No limit", "size": "10"})
price_change_threshold_percent = FloatField('Threshold in % for price changes since the original price', validators=[
@@ -24,10 +31,8 @@ class RestockSettingsForm(Form):
follow_price_changes = BooleanField('Follow price changes', default=True)
class processor_settings_form(processor_text_json_diff_form):
-
restock_settings = FormField(RestockSettingsForm)
-
def extra_tab_content(self):
return 'Restock & Price Detection'
@@ -36,35 +41,32 @@ class processor_settings_form(processor_text_json_diff_form):
{% from '_helpers.html' import render_field, render_checkbox_field, render_button %}
- """
\ No newline at end of file
+ """