Skip to content

Commit 9d8ee98

Browse files
authored
Merge branch 'main' into pre_commit_fix
2 parents 22cfb89 + 6fca75c commit 9d8ee98

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ssb-konjunk"
3-
version = "2.1.3"
3+
version = "2.1.4"
44
description = "SSB Konjunk 422"
55
authors = [
66
{name = "Johanne Saxegaard", email = "jox@ssb.no"},

src/ssb_konjunk/dash/utils.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def setup(config: type[Any]) -> None:
1212
Args:
1313
config (type[Config]): Klassen som inneholder konfigurasjonsinnstillinger.
1414
"""
15+
def setup(config) -> None:
16+
1517
global _config
1618
_config = config
1719

@@ -61,3 +63,27 @@ def dropdown_getter(file: str | None = None) -> list[dict[str, str]]:
6163
for item in sorted(datas.get_all_periods(), reverse=True)
6264
]
6365
return dropdown_data
66+
67+
68+
@cache
69+
def get_assets_folder() -> str:
70+
"""
71+
Lager en temp mappe som har assets fra pakken og assets lokalt.
72+
73+
lokale assets overskriver pakke assets.
74+
75+
Returns:
76+
str: path til temp mappe med assets.
77+
"""
78+
package_assets = Path(ssb_konjunk.__file__).parent / "dash" / "assets"
79+
local_assets = Path("dash/assets")
80+
81+
combined = Path(tempfile.mkdtemp(prefix="dash_assets_"))
82+
83+
if package_assets.exists():
84+
shutil.copytree(package_assets, combined, dirs_exist_ok=True)
85+
86+
if local_assets.exists():
87+
shutil.copytree(local_assets, combined, dirs_exist_ok=True)
88+
89+
return str(combined)

0 commit comments

Comments
 (0)