refactor fix

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2025-05-31 14:58:44 +02:00
parent 272ae1cd55
commit c566e4f40a
4 changed files with 26 additions and 28 deletions

View File

@@ -96,7 +96,7 @@ in {
workspace = let workspace = let
d1 = if hyper.host == "NxXPS" then monitors.xps.main.name else (if hyper.host == "NxNORTH" then monitors.north.main.name else monitors.ace.main.name); d1 = if hyper.host == "NxXPS" then monitors.xps.main.name else (if hyper.host == "NxNORTH" then monitors.north.main.name else monitors.ace.main.name);
d2 = if hyper.host == "NxXPS" then monitors.xps.second.name else (if hyper.hyper.host == "NxNORTH" then monitors.north.left.name else monitors.ace.main.name); d2 = if hyper.host == "NxXPS" then monitors.xps.second.name else (if hyper.host == "NxNORTH" then monitors.north.left.name else monitors.ace.main.name);
d3 = if hyper.host == "NxXPS" then monitors.xps.main.name else (if hyper.host == "NxNORTH" then monitors.north.main.name else monitors.ace.main.name); d3 = if hyper.host == "NxXPS" then monitors.xps.main.name else (if hyper.host == "NxNORTH" then monitors.north.main.name else monitors.ace.main.name);
# d3 = if hyper.host == "NxXPS" then monitors.xps.main.name else (if hyper.hyper.host == "NxNORTH" then monitors.north.right.name else monitors.ace.main.name); # d3 = if hyper.host == "NxXPS" then monitors.xps.main.name else (if hyper.hyper.host == "NxNORTH" then monitors.north.right.name else monitors.ace.main.name);
compact = "gapsin:0, gapsout:0, bordersize:1, rounding:false"; compact = "gapsin:0, gapsout:0, bordersize:1, rounding:false";

View File

@@ -103,7 +103,7 @@
reflex reflex
ripgrep ripgrep
screen screen
speedtest-go # speedtest-go
spicetify-cli spicetify-cli
sssnake sssnake
swww swww
@@ -121,14 +121,12 @@
inputs.zen-browser.packages."${system}".default inputs.zen-browser.packages."${system}".default
] ++ (if hyper.host != "NxACE" then [ ] ++ (if (hyper.host != "NxACE") then [
signal-desktop signal-desktop
obsidian obsidian
zoom-us zoom-us
inkscape inkscape
] else { ] else []);
});
xdg = { xdg = {
enable = true; enable = true;

View File

@@ -5,7 +5,7 @@
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {
OnBootSec = "40m"; OnBootSec = "40m";
OnUnitActiveSec = "24h"; OnUnitActiveSec = "12h";
Unit = "nx_cal_dicos.service"; Unit = "nx_cal_dicos.service";
}; };
}; };
@@ -26,9 +26,9 @@ from ics.event import datetime
NETTO_STUNDE = 18.46 NETTO_STUNDE = 18.46
WEEKLY = 12 WEEKLY = 12
week_dict = {} # week_dict = {}
latest_week = 0 # latest_week = 0
latest_goal = WEEKLY # latest_goal = WEEKLY
deficit = 0 deficit = 0
def fraction_to_unicode(frac): def fraction_to_unicode(frac):
@@ -51,10 +51,10 @@ def fraction_to_unicode(frac):
def modify_event(event): def modify_event(event):
"""Modify the event if it contains 'DICOS' in the SUMMARY.""" """Modify the event if it contains 'DICOS' in the SUMMARY."""
global week_dict # global week_dict
global latest_goal # global latest_goal
global latest_week # global latest_week
global deficit # global deficit
if event.name is not None and "DICOS" in event.name: if event.name is not None and "DICOS" in event.name:
length = (event.end - event.begin).seconds / 3600 length = (event.end - event.begin).seconds / 3600
@@ -63,20 +63,20 @@ def modify_event(event):
# Calculate total hours for DICOS events in the same week # Calculate total hours for DICOS events in the same week
year, week, _ = event.begin.isocalendar() year, week, _ = event.begin.isocalendar()
if week != latest_week: # if week != latest_week:
try: # try:
deficit = latest_goal - week_dict[f"{year}_{latest_week}"] # deficit = latest_goal - week_dict[f"{year}_{latest_week}"]
except KeyError: # except KeyError:
deficit = 0 # deficit = 0
week_dict[f"{year}_{week}"] = length + (week_dict[f"{year}_{week}"] if f"{year}_{week}" in week_dict else 0) # week_dict[f"{year}_{week}"] = length + (week_dict[f"{year}_{week}"] if f"{year}_{week}" in week_dict else 0)
progress = week_dict[f"{year}_{week}"] # progress = week_dict[f"{year}_{week}"]
goal = WEEKLY + deficit # goal = WEEKLY + deficit
if week != latest_week: # if week != latest_week:
latest_goal = goal # latest_goal = goal
latest_week = week # latest_week = week
try: try:
new_description = [event.description.split("\n")[0]] new_description = [event.description.split("\n")[0]]
@@ -84,8 +84,8 @@ def modify_event(event):
new_description = ["::"] new_description = ["::"]
new_description.append("") new_description.append("")
new_description.append(f"Netto: {money_made[0]:.0f},{int(money_made[1] * 10):02d}") new_description.append(f"Netto: {money_made[0]:.0f},{int(money_made[1] * 10):02d}")
new_description.append(f"This weeks porgress: ({fraction_to_unicode(progress)}/{fraction_to_unicode(goal)})") # new_description.append(f"This weeks porgress: ({fraction_to_unicode(progress)}/{fraction_to_unicode(goal)})")
new_description.append(f"You're {fraction_to_unicode(abs(deficit))}h in the {'plus' if deficit < 0 else 'minus'} this week.") # new_description.append(f"You're {fraction_to_unicode(abs(deficit))}h in the {'plus' if deficit < 0 else 'minus'} this week.")
event.description = "\n".join(new_description) event.description = "\n".join(new_description)

View File

@@ -44,7 +44,7 @@
# appendConfig = ''''; # appendConfig = '''';
clientMaxBodySize = "20m"; clientMaxBodySize = "20m";
defaultHTTPListenPort = 80; defaultHTTPListenPort = 80;
defaultListenAddresses = [ "0.0.0.0" ] ++ lib.optional config.networking.enableIPv6 "[::0]"; defaultListenAddresses = [ "0.0.0.0" ] ++ pkgs.lib.optional config.networking.enableIPv6 "[::0]";
defaultListen = dl; defaultListen = dl;
defaultMimeTypes = "${pkgs.mailcap}/etc/nginx/mime.types"; defaultMimeTypes = "${pkgs.mailcap}/etc/nginx/mime.types";
defaultSSLListenPort = 443; defaultSSLListenPort = 443;