Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 957c32e3a7 | |||
| 8d069df9d1 |
@ -480,6 +480,12 @@ whatever time KoReader reports, we need to know, given the date and the user
|
|||||||
profile's historic timezone, how many hours to adjust the KoReader time to get
|
profile's historic timezone, how many hours to adjust the KoReader time to get
|
||||||
to GMT to save it in the database.
|
to GMT to save it in the database.
|
||||||
|
|
||||||
|
* Version 39.1 [1/1]
|
||||||
|
** DONE [#A] Fix bug in tests for notes saving :bug:scrobbles:forms:
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: 68a011b2-bb6f-3ba8-2312-5947c41db9ac
|
||||||
|
:END:
|
||||||
|
|
||||||
* Version 39.0 [3/3]
|
* Version 39.0 [3/3]
|
||||||
** DONE [#B] Clean up org-mode tasks metadata :bug:tasks:metadata:
|
** DONE [#B] Clean up org-mode tasks metadata :bug:tasks:metadata:
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "vrobbler"
|
name = "vrobbler"
|
||||||
version = "39.0"
|
version = "39.1"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Colin Powell <colin@unbl.ink>"]
|
authors = ["Colin Powell <colin@unbl.ink>"]
|
||||||
|
|
||||||
|
|||||||
@ -607,7 +607,8 @@ def test_scrobble_detail_view_post_updates_log(client):
|
|||||||
|
|
||||||
scrobble.refresh_from_db()
|
scrobble.refresh_from_db()
|
||||||
assert scrobble.log["description"] == "Updated description"
|
assert scrobble.log["description"] == "Updated description"
|
||||||
assert scrobble.log["notes"] == ["Updated note"]
|
assert isinstance(scrobble.log["notes"], dict)
|
||||||
|
assert list(scrobble.log["notes"].values()) == ["Updated note"]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skip("Need to refactor")
|
@pytest.mark.skip("Need to refactor")
|
||||||
|
|||||||
@ -112,11 +112,14 @@ class NotesDictWidget(forms.Widget):
|
|||||||
|
|
||||||
def value_from_datadict(self, data, files, name):
|
def value_from_datadict(self, data, files, name):
|
||||||
timestamps = data.getlist(f"{name}_timestamps")
|
timestamps = data.getlist(f"{name}_timestamps")
|
||||||
contents = data.getlist(f"{name}_contents")
|
if timestamps:
|
||||||
return {
|
contents = data.getlist(f"{name}_contents")
|
||||||
"timestamps": timestamps,
|
result = {}
|
||||||
"contents": contents,
|
for i, ts in enumerate(timestamps):
|
||||||
}
|
if i < len(contents) and ts:
|
||||||
|
result[ts] = contents[i]
|
||||||
|
return result if result else ""
|
||||||
|
return data.get(name, "")
|
||||||
|
|
||||||
def get_context(self, name, value, attrs):
|
def get_context(self, name, value, attrs):
|
||||||
context = super().get_context(name, value, attrs)
|
context = super().get_context(name, value, attrs)
|
||||||
@ -139,10 +142,14 @@ class NotesDictField(forms.Field):
|
|||||||
def clean(self, value):
|
def clean(self, value):
|
||||||
if not value:
|
if not value:
|
||||||
return {}
|
return {}
|
||||||
result = {}
|
|
||||||
timestamps = value.get("timestamps", [])
|
if isinstance(value, str):
|
||||||
contents = value.get("contents", [])
|
if value.strip():
|
||||||
for i, ts in enumerate(timestamps):
|
from datetime import datetime
|
||||||
if i < len(contents) and ts and contents[i].strip():
|
return {datetime.now().isoformat(): value.strip()}
|
||||||
result[ts] = contents[i].strip()
|
return {}
|
||||||
return result if result else {}
|
|
||||||
|
if isinstance(value, dict):
|
||||||
|
return value
|
||||||
|
|
||||||
|
return {}
|
||||||
|
|||||||
Reference in New Issue
Block a user