Compare commits

...

2 Commits

Author SHA1 Message Date
64d9bbbad2
added models for full time hours + employment rate 2025-02-23 21:50:52 +01:00
9156142c04
added config.py 2025-02-23 21:50:52 +01:00
10 changed files with 154 additions and 13 deletions

12
.idea/dataSources.xml generated
View File

@ -1,20 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="db" uuid="77a8092c-4d7c-43f6-806c-af3a9c288eeb">
<data-source source="LOCAL" name="Django default" uuid="5554f55f-0dda-4059-8562-7321c41658f9">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
<remarks>$PROJECT_DIR$/TimeDispatcher/settings.py</remarks>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db.sqlite3</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
<libraries>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/xerial/sqlite-jdbc/3.45.1.0/sqlite-jdbc-3.45.1.0.jar</url>
</library>
<library>
<url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.45.1/org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar</url>
</library>
</libraries>
</data-source>
</component>
</project>

2
.idea/discord.xml generated
View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
<option name="applicationTheme" value="default" />
<option name="iconsTheme" value="default" />

6
.idea/httpClient.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="HttpClientEndpointsTabState">
<option name="requestToText" value="&lt;CachedHttpClientTabRequests&gt;&#10; &lt;entry key=&quot;da376d1083f024ef0956ab871581b6fa09ce0fda&quot; value=&quot;###&amp;#10;POST http://localhost:8000/projects/{{id}}/set_parent/&quot; /&gt;&#10;&lt;/CachedHttpClientTabRequests&gt;" />
</component>
</project>

99
.idea/icon.svg generated Normal file
View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="64"
height="64"
viewBox="0 0 64 64"
version="1.1"
id="svg1"
sodipodi:docname="logo.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="true"
inkscape:zoom="11.559708"
inkscape:cx="31.012894"
inkscape:cy="41.047749"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="1"
spacingy="1"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="8"
enabled="true"
visible="true" />
</sodipodi:namedview>
<defs
id="defs1">
<inkscape:path-effect
effect="fillet_chamfer"
id="path-effect3"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,0,1,0,2,0,1 @ F,0,1,1,0,2,0,1 @ F,0,1,1,0,2,0,1"
radius="0"
unit="px"
method="auto"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g4">
<path
style="fill:#69c935;fill-opacity:1;stroke-width:6;stroke-linecap:square;stroke:none"
d="m 8,10 v 4 a 2,2 45 0 0 2,2 h 7 a 2,2 45 0 1 2,2 v 36 a 2,2 45 0 0 2,2 h 4 a 2,2 135 0 0 2,-2 V 18 a 2,2 135 0 1 2,-2 h 7 a 2,2 135 0 0 2,-2 V 10 A 2,2 45 0 0 36,8 H 10 a 2,2 135 0 0 -2,2 z"
id="path1"
sodipodi:nodetypes="ccccccccc"
inkscape:path-effect="#path-effect3"
inkscape:original-d="m 8,8 v 8 h 11 v 40 h 8 V 16 H 38 V 8 Z" />
<g
id="g3"
style="stroke:#61ba31;stroke-opacity:1;fill:none">
<path
id="path2"
style="fill:none;stroke:#61ba31;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M 44.834929,13.274537 C 51.52452,17.296808 56,24.625752 56,33 56,45.702549 45.702549,56 33,56"
sodipodi:nodetypes="csc" />
<path
style="fill:none;stroke:#61ba31;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
d="M 44,47 33,33 38,26"
id="path3" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

3
TimeDispatcher/config.py Normal file
View File

@ -0,0 +1,3 @@
class Config:
# Number of hours in an off-day
WORKING_HOURS_PER_OFF_DAY = 8.2

View File

@ -1,3 +1,4 @@
from TimeDispatcher.config import Config
from TimeDispatcher.settings import APP_VERSION, DEBUG
@ -17,3 +18,10 @@ def navbar_links(request):
{'view': 'import', 'label': 'Import'},
]
}
def app_config(request):
return {
"config": {
"WORKING_HOURS_PER_OFF_DAY": Config.WORKING_HOURS_PER_OFF_DAY
}
}

View File

@ -19,7 +19,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
APP_VERSION = "0.1.0"
load_dotenv(BASE_DIR / ".env")
load_dotenv(BASE_DIR / ".env", override=True)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
@ -68,8 +68,9 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'context_processors.version',
'context_processors.navbar_links'
'TimeDispatcher.context_processors.app_config',
'TimeDispatcher.context_processors.version',
'TimeDispatcher.context_processors.navbar_links'
],
},
},

View File

@ -1,6 +1,16 @@
from django.apps import AppConfig
from django.utils.autoreload import autoreload_started
from TimeDispatcher.settings import BASE_DIR
def watchdog(sender, **kwargs):
sender.watch_dir(BASE_DIR, ".env")
class DispatcherConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'dispatcher'
def ready(self):
autoreload_started.connect(watchdog)

View File

@ -53,3 +53,20 @@ class RealSageXHours(models.Model):
constraints = [
models.UniqueConstraint(fields=["parent", "date"], name="unique_monthly_sagex")
]
class FullTimeMonthlyHours(models.Model):
date = models.DateField(unique=True)
hours = models.DurationField(default=timedelta)
class EmploymentRate:
rate = models.DecimalField(max_digits=10, decimal_places=2)
start_date = models.DateField()
class Meta:
indexes = [
models.Index(fields=["start_date"])
]

View File

@ -6,6 +6,9 @@
<title>{% block title %}Title{% endblock %}</title>
<link rel="shortcut icon" href="{% static "logo.svg" %}" type="image/x-svg">
<link rel="stylesheet" href="{% static "base.css" %}">
<script type="application/javascript">
const Config = {{ config|safe }}
</script>
<script src="{% static "base.js" %}"></script>
{% block head %}{% endblock %}
</head>