Vaihe 1/3: pohjatiedot (palveluyksiköt, palvelut ja työtehtävät)
- Uusi catalog-moduuli: palveluyksikkö → (palvelu) → työtehtävä ilman hintoja. - Pohjatiedot-sivu /catalog/ pääkäyttäjälle ja johdolle (oikeus catalog.manage): lisäys ja muokkaus dialogissa, Siirrä ylös / Siirrä alas, käytöstä poisto ja käyttöön otto. Fokus ja aria-live-ilmoitus jokaisen muutoksen jälkeen. - Rivejä ei poisteta. Käytöstä poistetun yläkohdan alla olevat rivit säilyttävät oman tilansa, mutta eivät ole valittavissa. Nimi on yksilöllinen samalla tasolla kirjainkoosta riippumatta. - Työtehtävän voi siirtää saman yksikön toiseen palveluun tai suoraan yksikön alle. - Luvun 11.1 lista data-migraationa (0002_seed), jos taulut ovat tyhjiä. - CatalogQueries: work_type_options, active_service_units ja get_work_type tehtäviä ja tuntikirjausta varten. - Import-linter-sopimukset, suomennokset, yksikkö-, integraatio- ja selaintestit. - Päivitetty CLAUDE.md ja määrittelyn kohta 16.3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
"""Initial service units, services and work types (specification 11.1, 16.3).
|
||||
|
||||
Added only when the tables are empty, so a database that already has base data is left as is.
|
||||
"""
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
# (service unit, is_shared, {service or None: [work types]})
|
||||
SEED = [
|
||||
(
|
||||
"Mediatuotanto",
|
||||
False,
|
||||
{
|
||||
"Videotuotanto": [
|
||||
"Videokuvaus",
|
||||
"Kuvausassistentti",
|
||||
"Editointi",
|
||||
"Animointi",
|
||||
"3D-mallinnus",
|
||||
],
|
||||
"Valokuvaus": ["Kuvaus", "Editointi"],
|
||||
"Äänituotanto": ["Äänitys", "Editointi"],
|
||||
},
|
||||
),
|
||||
("Markkinointi", False, {None: ["Graafinen työ", "Julkaisutyö", "Kampanjatyö"]}),
|
||||
("Painotuotanto", False, {None: ["Painotyö", "Asennus"]}),
|
||||
("Ylläpitopalvelut", False, {None: ["Asennustyö", "Päivitystyö"]}),
|
||||
("Verkkosivut", False, {None: ["Ohjelmointityö"]}),
|
||||
(
|
||||
"Ohjelmistot",
|
||||
False,
|
||||
{None: ["Ohjelmointityö", "Ohjelmointityö vaativa", "Pelimoottoritoteutukset"]},
|
||||
),
|
||||
("Kuluttajapalvelut", False, {None: ["Valokuvaus", "Tulosteet", "Passikuvat", "Digitointi"]}),
|
||||
(
|
||||
"Kaikille yhteiset",
|
||||
True,
|
||||
{None: ["Suunnittelu", "Tuotanto", "Projektin johtaminen", "Konsultointi", "Koulutus"]},
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def seed(apps, schema_editor):
|
||||
unit_model = apps.get_model("catalog", "ServiceUnitModel")
|
||||
service_model = apps.get_model("catalog", "ServiceModel")
|
||||
work_type_model = apps.get_model("catalog", "WorkTypeModel")
|
||||
if unit_model.objects.exists():
|
||||
return
|
||||
for unit_order, (unit_name, is_shared, groups) in enumerate(SEED, start=1):
|
||||
unit = unit_model.objects.create(name=unit_name, is_shared=is_shared, sort_order=unit_order)
|
||||
for service_order, (service_name, work_types) in enumerate(groups.items(), start=1):
|
||||
service = None
|
||||
if service_name is not None:
|
||||
service = service_model.objects.create(
|
||||
service_unit=unit, name=service_name, sort_order=service_order
|
||||
)
|
||||
for order, name in enumerate(work_types, start=1):
|
||||
work_type_model.objects.create(
|
||||
service_unit=unit, service=service, name=name, sort_order=order
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("catalog", "0001_initial")]
|
||||
|
||||
operations = [migrations.RunPython(seed, migrations.RunPython.noop)]
|
||||
Reference in New Issue
Block a user