kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Snapshot count from history was not updated in watch after using [clear history] (#2459)
rodzic
01f910f840
commit
a1d04bb37f
|
@ -238,6 +238,8 @@ class model(dict):
|
||||||
|
|
||||||
if len(tmp_history):
|
if len(tmp_history):
|
||||||
self.__newest_history_key = list(tmp_history.keys())[-1]
|
self.__newest_history_key = list(tmp_history.keys())[-1]
|
||||||
|
else:
|
||||||
|
self.__newest_history_key = None
|
||||||
|
|
||||||
self.__history_n = len(tmp_history)
|
self.__history_n = len(tmp_history)
|
||||||
|
|
||||||
|
|
|
@ -242,6 +242,14 @@ class ChangeDetectionStore:
|
||||||
def clear_watch_history(self, uuid):
|
def clear_watch_history(self, uuid):
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
# JSON Data, Screenshots, Textfiles (history index and snapshots), HTML in the future etc
|
||||||
|
for item in pathlib.Path(os.path.join(self.datastore_path, uuid)).rglob("*.*"):
|
||||||
|
unlink(item)
|
||||||
|
|
||||||
|
# Force the attr to recalculate
|
||||||
|
bump = self.__data['watching'][uuid].history
|
||||||
|
|
||||||
|
# Do this last because it will trigger a recheck due to last_checked being zero
|
||||||
self.__data['watching'][uuid].update({
|
self.__data['watching'][uuid].update({
|
||||||
'browser_steps_last_error_step' : None,
|
'browser_steps_last_error_step' : None,
|
||||||
'check_count': 0,
|
'check_count': 0,
|
||||||
|
@ -258,13 +266,6 @@ class ChangeDetectionStore:
|
||||||
'track_ldjson_price_data': None,
|
'track_ldjson_price_data': None,
|
||||||
})
|
})
|
||||||
|
|
||||||
# JSON Data, Screenshots, Textfiles (history index and snapshots), HTML in the future etc
|
|
||||||
for item in pathlib.Path(os.path.join(self.datastore_path, uuid)).rglob("*.*"):
|
|
||||||
unlink(item)
|
|
||||||
|
|
||||||
# Force the attr to recalculate
|
|
||||||
bump = self.__data['watching'][uuid].history
|
|
||||||
|
|
||||||
self.needs_write_urgent = True
|
self.needs_write_urgent = True
|
||||||
|
|
||||||
def add_watch(self, url, tag='', extras=None, tag_uuids=None, write_to_disk_now=True):
|
def add_watch(self, url, tag='', extras=None, tag_uuids=None, write_to_disk_now=True):
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
import time
|
import time
|
||||||
from flask import url_for
|
from flask import url_for
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, extract_rss_token_from_UI
|
from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, extract_rss_token_from_UI, \
|
||||||
|
extract_UUID_from_client
|
||||||
|
|
||||||
sleep_time_for_fetch_thread = 3
|
sleep_time_for_fetch_thread = 3
|
||||||
|
|
||||||
|
@ -141,6 +142,14 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
||||||
assert b'Mark all viewed' not in res.data
|
assert b'Mark all viewed' not in res.data
|
||||||
assert b'unviewed' not in res.data
|
assert b'unviewed' not in res.data
|
||||||
|
|
||||||
|
# #2458 "clear history" should make the Watch object update its status correctly when the first snapshot lands again
|
||||||
|
uuid = extract_UUID_from_client(client)
|
||||||
|
client.get(url_for("clear_watch_history", uuid=uuid))
|
||||||
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
||||||
|
wait_for_all_checks(client)
|
||||||
|
res = client.get(url_for("index"))
|
||||||
|
assert b'preview/' in res.data
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cleanup everything
|
# Cleanup everything
|
||||||
res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
|
res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
|
||||||
|
|
|
@ -250,8 +250,7 @@ class update_worker(threading.Thread):
|
||||||
# Clear last errors (move to preflight func?)
|
# Clear last errors (move to preflight func?)
|
||||||
self.datastore.data['watching'][uuid]['browser_steps_last_error_step'] = None
|
self.datastore.data['watching'][uuid]['browser_steps_last_error_step'] = None
|
||||||
|
|
||||||
# DeepCopy so we can be sure we don't accidently change anything by reference
|
watch = self.datastore.data['watching'].get(uuid)
|
||||||
watch = deepcopy(self.datastore.data['watching'].get(uuid))
|
|
||||||
|
|
||||||
logger.info(f"Processing watch UUID {uuid} Priority {queued_item_data.priority} URL {watch['url']}")
|
logger.info(f"Processing watch UUID {uuid} Priority {queued_item_data.priority} URL {watch['url']}")
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
|
Ładowanie…
Reference in New Issue