From 9140e731f9a24441548dcd11443e091a5036dd1a Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 23 Nov 2026 19:05:05 +0100 Subject: [PATCH] =?UTF-8?q?Behandle=20=C3=9Cbungen=20aus=20Shinkan=20wie?= =?UTF-8?q?=20jede=20=C3=9Cbung,=20ordne=20die=20Navigation=20neu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Importierte Übungen werden im selben Editor bearbeitet und als neue Fassung gespeichert. Lokal bearbeitete Texte und Felder bleiben bei der nächsten Übernahme erhalten, bei Änderung auf beiden Seiten entscheidet die Redaktion. Ein Fehler im Editor setzte die Herkunft der Varianten auf lokal und ist behoben. Übungen haben einen Einstieg unter Inhalte, Fachliche Säulen und Redaktionelle Stammdaten stehen in der Gruppe Stammdaten, die Übernahme ist ein Weg im Übungsbestand. Co-Authored-By: Claude Sonnet 5.5 --- app/Domain/Catalog/ShinkanImport.php | 253 +++++++++++++++--- .../Pages/RedaktionelleStammdaten.php | 4 +- app/Filament/Pages/Uebernahme.php | 22 +- .../Combinations/CombinationResource.php | 2 +- .../Compositions/Pages/EditComposition.php | 4 +- .../Resources/Pillars/PillarResource.php | 4 +- .../Resources/Practices/PracticeResource.php | 2 +- app/Filament/Support/ListsCompositions.php | 2 +- .../uebungen-shinkan-feldzuordnung.md | 3 +- .../views/filament/pages/uebernahme.blade.php | 13 + tests/Feature/ShinkanUebernahmeTest.php | 117 +++++++- tests/Feature/UebungNavigationTest.php | 71 +++++ 12 files changed, 438 insertions(+), 59 deletions(-) create mode 100644 tests/Feature/UebungNavigationTest.php diff --git a/app/Domain/Catalog/ShinkanImport.php b/app/Domain/Catalog/ShinkanImport.php index 94669d3..d6569f2 100644 --- a/app/Domain/Catalog/ShinkanImport.php +++ b/app/Domain/Catalog/ShinkanImport.php @@ -33,6 +33,17 @@ class ShinkanImport 'trainer_notes' => 'Trainerhinweise', ]; + /** Änderungshinweis der Textfassungen, die die Übernahme angelegt hat. Alles andere ist eine lokale Bearbeitung. */ + private const IMPORT_NOTE = 'Übernahme aus Shinkan'; + + /** Fassungsfelder der Quelle: Katalogfeld => [Feld der lokalen Fassung, Bezeichnung]. */ + private const FIELDS = [ + 'goal' => ['learning_goal', 'Lernziel'], + 'duration_min' => ['duration_minutes', 'Dauer (von)'], + 'duration_max' => ['duration_max', 'Dauer (bis)'], + 'equipment' => ['material_note', 'Ausstattung'], + ]; + public function configured(): bool { return app(ShinkanConnection::class)->configured(); @@ -226,6 +237,8 @@ public function preview(ExerciseSource $source): array 'media' => array_map(fn (array $media): string => ($media['title'] ?? 'Medium').' ('.($media['media_type'] ?? '').')', array_values(array_filter((array) ($document['media'] ?? []), 'is_array'))), 'changes' => $previous === null ? [] : $this->changes($previous->payload, $document, $source), 'conflicts' => $snapshot === null ? [] : $this->conflicts($source, $document), + 'text_conflicts' => $snapshot === null ? [] : $this->textDecisions($source, $document, 'conflict'), + 'kept_local' => $snapshot === null ? [] : array_column($this->textDecisions($source, $document, 'keep_local'), 'label'), 'identical' => $snapshot !== null && $snapshot->adopted_version_id !== null, 'excluded' => $source->availability === ExerciseSource::WITHDRAWN, ]; @@ -327,14 +340,50 @@ public function conflicts(ExerciseSource $source, array $document): array return array_values($open); } + /** + * Texte und Felder, die lokal bearbeitet wurden: `keep_local` bleiben erhalten, bei `conflict` hat auch die Quelle + * geändert und die Redaktion entscheidet. + * + * @param array $document + * @return list + */ + public function textDecisions(ExerciseSource $source, array $document, string $wanted): array + { + $previousSnapshot = $this->lastAdopted($source); + + if ($previousSnapshot === null || $source->composition === null) { + return []; + } + + $previousSource = $previousSnapshot->payload; + $result = []; + + foreach ($this->plan($source, $document, $previousSource) as $item) { + if ($item['kind'] === 'text' && $item['decision'] === $wanted) { + $result[] = ['key' => $item['key'], 'label' => $item['label']]; + } + } + + $latest = $source->composition->versions()->orderByDesc('number')->first(); + + foreach (self::FIELDS as $field => [$column, $label]) { + if ($latest !== null && $this->classifyField($latest->{$column}, $previousSource[$field] ?? null, $document[$field] ?? null) === $wanted) { + $result[] = ['key' => $field, 'label' => $label]; + } + } + + return $result; + } + /** * Übernimmt genau den Stand, den die Redaktion in der Vorschau gesehen hat. Hat sich der Stand seither geändert oder * wurde die Quelle ausgeblendet, wird nichts übernommen. Identische bereits übernommene Stände ergeben keine Fassung. * * @param array $reassign neue Zuordnung entfallener Quellvarianten: alter Schlüssel => neuer Schlüssel oder '' + * @param array $choices bei lokal und in der Quelle geänderten Angaben: Schlüssel => `lokal` oder `quelle` * @return array{status: string, message: string, version?: CompositionVersion} */ - public function adoptPreviewed(ExerciseSource $source, int $previewedSnapshot, array $reassign = [], ?User $actor = null): array + public function adoptPreviewed(ExerciseSource $source, int $previewedSnapshot, array $reassign = [], ?User $actor = null, array $choices = []): array { $source->refresh(); $latest = $source->latestSnapshot(); @@ -352,7 +401,7 @@ public function adoptPreviewed(ExerciseSource $source, int $previewedSnapshot, a } try { - $version = $this->adopt($latest, $actor, $reassign); + $version = $this->adopt($latest, $actor, $reassign, $choices); } catch (DomainRuleException $exception) { return ['status' => 'fehler', 'message' => $exception->getMessage()]; } @@ -362,11 +411,17 @@ public function adoptPreviewed(ExerciseSource $source, int $previewedSnapshot, a /** * Die bewusste Übernahme: aus dem Inhaltsstand wird eine neue, unveränderliche lokale Fassung. Wiederholt man sie, - * entsteht keine zweite Fassung. Lokale Ergänzungen der bisherigen Fassung werden übernommen. + * entsteht keine zweite Fassung. + * + * Eine importierte Übung ist eine Übung wie jede andere und lässt sich bearbeiten. Lokal bearbeitete Texte und Felder + * bleiben deshalb erhalten, solange die Quelle sie nicht ebenfalls geändert hat. Haben beide Seiten geändert, legt die + * Redaktion fest, welcher Stand gilt (`$choices`). Lokale Ergänzungen bleiben erhalten; entfällt ihre Quellvariante, + * legt die Redaktion die neue Zuordnung fest (`$reassign`). * * @param array $reassign + * @param array $choices Schlüssel => `lokal` oder `quelle` */ - public function adopt(ExerciseSourceSnapshot $snapshot, ?User $actor = null, array $reassign = []): CompositionVersion + public function adopt(ExerciseSourceSnapshot $snapshot, ?User $actor = null, array $reassign = [], array $choices = []): CompositionVersion { $snapshot->refresh(); @@ -374,57 +429,73 @@ public function adopt(ExerciseSourceSnapshot $snapshot, ?User $actor = null, arr return $snapshot->adoptedVersion; } - return DB::transaction(function () use ($snapshot, $actor, $reassign): CompositionVersion { + return DB::transaction(function () use ($snapshot, $actor, $reassign, $choices): CompositionVersion { $source = $snapshot->source; $document = $snapshot->payload; $content = app(ContentService::class); $title = trim((string) ($document['title'] ?? '')) ?: 'Übung aus Shinkan'; $previousSnapshot = $this->lastAdopted($source); + $previousSource = $previousSnapshot?->payload ?? []; $composition = $source->composition ?? $this->createComposition($title, (string) ($document['summary'] ?? '')); if ($source->composition !== null && $previousSnapshot !== null) { - $this->carryOverTexts($composition, $previousSnapshot->payload, $document); + $this->carryOverTexts($composition, $previousSource, $document); } $previous = $composition->versions()->orderByDesc('number')->with('members.variant', 'variants')->first(); $variants = []; $members = []; - foreach (self::SECTIONS as $field => $label) { - $text = trim((string) ($document[$field] ?? '')); + foreach ($this->plan($source, $document, $previousSource) as $item) { + if ($item['kind'] === 'variant') { + $variants[] = $item['variant']; - if ($text !== '') { - $members[] = [ - 'role' => $label, - 'target' => $this->section($source, $field, $title.' · '.$label, $text), - 'origin' => 'quelle', - ]; - } - } - - foreach ((array) ($document['variants'] ?? []) as $variant) { - $key = (string) ($variant['id'] ?? ''); - - if ($key === '') { continue; } - $variants[] = [ - 'key' => $key, - 'name' => (string) ($variant['name'] ?? '') ?: 'Variante', - 'description' => (string) ($variant['description'] ?? ''), - 'origin' => 'quelle', - ]; - $changes = trim((string) ($variant['execution_changes'] ?? '')); + $latest = $item['latest']; + $decision = $item['decision']; - if ($changes !== '') { - $members[] = [ - 'role' => 'Abweichung der Durchführung', - 'target' => $this->section($source, 'variant:'.$key, $title.' · '.($variant['name'] ?? 'Variante').' · Abweichung', $changes), - 'variant' => $key, - 'origin' => 'quelle', - ]; + if ($decision === 'conflict') { + $decision = ($choices[$item['key']] ?? null) === 'lokal' ? 'keep_local' + : (($choices[$item['key']] ?? null) === 'quelle' ? 'source' : 'conflict'); } + + if ($decision === 'conflict') { + throw new DomainRuleException('„'.$item['label'].'“ wurde lokal und in der Quelle geändert. Lege fest, welcher Stand gilt.'); + } + + $keepLocal = $decision === 'keep_local' && $latest !== null; + $target = $keepLocal ? $latest : $this->sectionVersion($source, $item['field'], $item['title'], $item['text'], $latest); + $members[] = array_filter([ + 'role' => $item['role'], + 'target' => $target, + 'variant' => $item['variant_key'], + 'origin' => $keepLocal || ($latest !== null && $latest->id === $target->id && $latest->change_note !== self::IMPORT_NOTE) ? 'lokal' : 'quelle', + ], fn ($value): bool => $value !== null); + } + + // Fassungsfelder: lokal geändert bleibt erhalten, solange die Quelle den Wert nicht ebenfalls geändert hat. + $fields = []; + + foreach (self::FIELDS as $field => [$column, $label]) { + $value = $document[$field] ?? null; + + if ($previous !== null && $previousSnapshot !== null) { + $decision = $this->classifyField($previous->{$column}, $previousSource[$field] ?? null, $value); + + if ($decision === 'conflict') { + $decision = ($choices[$field] ?? null) === 'lokal' ? 'keep_local' : (($choices[$field] ?? null) === 'quelle' ? 'source' : 'conflict'); + } + + if ($decision === 'conflict') { + throw new DomainRuleException('„'.$label.'“ wurde lokal und in der Quelle geändert. Lege fest, welcher Stand gilt.'); + } + + $value = $decision === 'keep_local' ? $previous->{$column} : $value; + } + + $fields[$column] = $value; } [$localMembers, $localVariants] = $this->localAdditions($previous, array_column($variants, 'key'), $reassign); @@ -432,12 +503,12 @@ public function adopt(ExerciseSourceSnapshot $snapshot, ?User $actor = null, arr $composition, [...$members, ...$localMembers], $actor, - 'Übernahme aus Shinkan', + self::IMPORT_NOTE, [ - 'learning_goal' => $document['goal'] ?? null, - 'duration_minutes' => $document['duration_min'] ?? null, - 'duration_max' => $document['duration_max'] ?? null, - 'material_note' => $document['equipment'] ?? null, + 'learning_goal' => $fields['learning_goal'], + 'duration_minutes' => $fields['duration_minutes'], + 'duration_max' => $fields['duration_max'], + 'material_note' => $fields['material_note'], 'source_snapshot_id' => $snapshot->id, ], [...$variants, ...$localVariants], @@ -450,6 +521,102 @@ public function adopt(ExerciseSourceSnapshot $snapshot, ?User $actor = null, arr }); } + /** + * Was die Übernahme aus dem Quellstand anlegen würde, mit der Entscheidung je Text: `source` (Quelltext gilt), + * `keep_local` (lokal bearbeitet, die Quelle hat sich nicht geändert) oder `conflict` (beide haben geändert). + * + * @param array $document + * @param array $previousSource + * @return list> + */ + private function plan(ExerciseSource $source, array $document, array $previousSource): array + { + $plan = []; + $title = trim((string) ($document['title'] ?? '')) ?: 'Übung aus Shinkan'; + + foreach (self::SECTIONS as $field => $label) { + $text = trim((string) ($document[$field] ?? '')); + + if ($text !== '') { + $plan[] = $this->textItem($source, $field, $label, $title.' · '.$label, $label, $text, null, $previousSource[$field] ?? null); + } + } + + foreach ((array) ($document['variants'] ?? []) as $variant) { + $key = (string) ($variant['id'] ?? ''); + + if ($key === '') { + continue; + } + + $name = (string) ($variant['name'] ?? '') ?: 'Variante'; + $plan[] = [ + 'kind' => 'variant', + 'variant' => ['key' => $key, 'name' => $name, 'description' => (string) ($variant['description'] ?? ''), 'origin' => 'quelle'], + ]; + $changes = trim((string) ($variant['execution_changes'] ?? '')); + + if ($changes !== '') { + $before = collect((array) ($previousSource['variants'] ?? []))->firstWhere('id', $key); + $plan[] = $this->textItem( + $source, + 'variant:'.$key, + 'Abweichung der Durchführung ('.$name.')', + $title.' · '.$name.' · Abweichung', + 'Abweichung der Durchführung', + $changes, + $key, + is_array($before) ? ($before['execution_changes'] ?? null) : null, + 'variant_'.$key, + ); + } + } + + return $plan; + } + + /** + * @return array + */ + private function textItem(ExerciseSource $source, string $field, string $label, string $title, string $role, string $text, ?string $variantKey, ?string $previousText, ?string $key = null): array + { + $element = ContentElement::query()->where('source_ref', 'shinkan:'.$source->source_id.':'.$field)->first(); + $latest = $element?->versions()->where('status', ContentVersionStatus::Bereit)->orderByDesc('number')->first(); + + return [ + 'kind' => 'text', + 'key' => $key ?? $field, + 'field' => $field, + 'label' => $label, + 'title' => $title, + 'role' => $role, + 'text' => $text, + 'variant_key' => $variantKey, + 'latest' => $latest, + 'decision' => $this->classifyText($latest, $text, $previousText), + ]; + } + + private function classifyText(?ContentElementVersion $latest, string $text, ?string $previousText): string + { + if ($latest === null || trim((string) $latest->body) === $text || $latest->change_note === self::IMPORT_NOTE) { + return 'source'; + } + + return $previousText === null || trim($previousText) !== $text ? 'conflict' : 'keep_local'; + } + + private function classifyField(mixed $local, mixed $previousSource, mixed $new): string + { + $plain = fn (mixed $value): string => $value === null ? '' : trim((string) $value); + + if ($plain($local) === $plain($new) || $plain($local) === $plain($previousSource)) { + return 'source'; + } + + return $plain($previousSource) !== $plain($new) ? 'conflict' : 'keep_local'; + } + /** * Titel und Kurzbeschreibung gehören zur Übung und nicht zur Fassung. Sie folgen der Quelle, solange die Redaktion sie * nicht lokal geändert hat; ein lokal geänderter Wert bleibt. @@ -529,7 +696,7 @@ private function localAdditions(?CompositionVersion $previous, array $sourceVari /** * Die Textfassung eines Abschnitts der Quelle. Unveränderter Text bleibt dieselbe Fassung. */ - private function section(ExerciseSource $source, string $field, string $title, string $text): ContentElementVersion + private function sectionVersion(ExerciseSource $source, string $field, string $title, string $text, ?ContentElementVersion $latest): ContentElementVersion { $content = app(ContentService::class); $ref = 'shinkan:'.$source->source_id.':'.$field; @@ -541,11 +708,9 @@ private function section(ExerciseSource $source, string $field, string $title, s $element->save(); } - $latest = $element->versions()->where('status', ContentVersionStatus::Bereit)->orderByDesc('number')->first(); - return $latest !== null && trim((string) $latest->body) === $text ? $latest - : $content->publishElementVersion($element, $text, [], 'Übernahme aus Shinkan'); + : $content->publishElementVersion($element, $text, [], self::IMPORT_NOTE); } private function createComposition(string $title, string $summary): Composition diff --git a/app/Filament/Pages/RedaktionelleStammdaten.php b/app/Filament/Pages/RedaktionelleStammdaten.php index b6b033f..851eb26 100644 --- a/app/Filament/Pages/RedaktionelleStammdaten.php +++ b/app/Filament/Pages/RedaktionelleStammdaten.php @@ -52,11 +52,11 @@ class RedaktionelleStammdaten extends Page implements HasTable { use InteractsWithTable; - protected static string|\UnitEnum|null $navigationGroup = 'Inhalte'; + protected static string|\UnitEnum|null $navigationGroup = 'Stammdaten'; protected static ?string $navigationLabel = 'Redaktionelle Stammdaten'; - protected static ?int $navigationSort = 6; + protected static ?int $navigationSort = 2; protected static ?string $slug = 'stammdaten'; diff --git a/app/Filament/Pages/Uebernahme.php b/app/Filament/Pages/Uebernahme.php index d839fdb..5f57a2e 100644 --- a/app/Filament/Pages/Uebernahme.php +++ b/app/Filament/Pages/Uebernahme.php @@ -56,6 +56,9 @@ class Uebernahme extends Page /** @var array> Quellübung => (entfallene Quellvariante => neue Zuordnung) */ public array $reassign = []; + /** @var array> Quellübung => (Text oder Feld => `lokal` oder `quelle`) */ + public array $textChoice = []; + /** @var list> */ public array $results = []; @@ -63,6 +66,15 @@ class Uebernahme extends Page public bool $feedbackError = false; + /** + * Die Übernahme ist ein Weg im Übungsbestand („Aus Shinkan übernehmen“) und kein eigener Einstieg. Nur wer die + * Anbindung pflegen darf, aber den Übungsbestand nicht sieht, bekommt den Eintrag in der Navigation. + */ + public static function shouldRegisterNavigation(): bool + { + return static::canConfigure() && ! ContentElementResource::editor(); + } + public static function canAccess(): bool { return ContentElementResource::editor() || static::canConfigure(); @@ -180,6 +192,12 @@ public function confirm(): void $changed[] = $entry['title']; } + foreach ($entry['text_conflicts'] as $conflict) { + if (! in_array($this->textChoice[$entry['source']][$conflict['key']] ?? 'offen', ['lokal', 'quelle'], true)) { + $open[] = $entry['title'].': '.$conflict['label']; + } + } + foreach ($entry['conflicts'] as $conflict) { if (! isset($this->reassign[$entry['source']][$conflict['key']]) || $this->reassign[$entry['source']][$conflict['key']] === 'offen') { $open[] = $entry['title'].': '.implode(', ', $conflict['members']); @@ -195,7 +213,7 @@ public function confirm(): void } if ($open !== []) { - $this->say('Lege zuerst die neue Zuordnung der lokalen Ergänzungen fest: '.implode('; ', $open).'.', true); + $this->say('Lege zuerst fest, was gilt: '.implode('; ', $open).'.', true); return; } @@ -205,7 +223,7 @@ public function confirm(): void foreach ($this->preview as $entry) { $source = ExerciseSource::query()->findOrFail($entry['source']); $reassign = array_map(fn (string $value): string => $value === 'gemeinsam' ? '' : $value, $this->reassign[$entry['source']] ?? []); - $result = $import->adoptPreviewed($source, (int) $entry['snapshot'], $reassign, $this->actor()); + $result = $import->adoptPreviewed($source, (int) $entry['snapshot'], $reassign, $this->actor(), $this->textChoice[$entry['source']] ?? []); $source->refresh(); $this->results[] = [ 'title' => $entry['title'], diff --git a/app/Filament/Resources/Combinations/CombinationResource.php b/app/Filament/Resources/Combinations/CombinationResource.php index 3225278..bbb38e5 100644 --- a/app/Filament/Resources/Combinations/CombinationResource.php +++ b/app/Filament/Resources/Combinations/CombinationResource.php @@ -17,7 +17,7 @@ class CombinationResource extends CompositionKindResource protected static ?string $pluralModelLabel = 'Fachliche Kombinationen'; - protected static ?int $navigationSort = 2; + protected static ?int $navigationSort = 5; public static function kind(): CompositionKind { diff --git a/app/Filament/Resources/Compositions/Pages/EditComposition.php b/app/Filament/Resources/Compositions/Pages/EditComposition.php index c92ca5c..4b705a1 100644 --- a/app/Filament/Resources/Compositions/Pages/EditComposition.php +++ b/app/Filament/Resources/Compositions/Pages/EditComposition.php @@ -1956,7 +1956,7 @@ protected function applyVersion(CompositionVersion $version): void { $this->members = app(EditorialCatalog::class)->rows($version, (int) $this->getRecord()->getKey()); $this->variants = $this->normalizeVariants($version->variants->map(fn ($variant): array => [ - 'key' => $variant->key, 'name' => $variant->name, 'description' => (string) $variant->description, + 'key' => $variant->key, 'name' => $variant->name, 'description' => (string) $variant->description, 'origin' => $variant->origin, ])->all()); $this->durationMax = $version->duration_max === null ? '' : (string) $version->duration_max; $this->prerequisites = (string) ($version->prerequisites ?? ''); @@ -2076,7 +2076,7 @@ protected function didacticChanged(CompositionVersion $version): bool $storedMinutes = $version->duration_minutes === null ? null : (int) $version->duration_minutes; $storedVariants = $this->normalizeVariants($version->variants->map(fn ($variant): array => [ - 'key' => $variant->key, 'name' => $variant->name, 'description' => (string) $variant->description, + 'key' => $variant->key, 'name' => $variant->name, 'description' => (string) $variant->description, 'origin' => $variant->origin, ])->all()); return $version->learning_goal !== $this->blank($this->learningGoal) diff --git a/app/Filament/Resources/Pillars/PillarResource.php b/app/Filament/Resources/Pillars/PillarResource.php index c7c0e16..d57303b 100644 --- a/app/Filament/Resources/Pillars/PillarResource.php +++ b/app/Filament/Resources/Pillars/PillarResource.php @@ -20,7 +20,7 @@ class PillarResource extends Resource { protected static ?string $model = Pillar::class; - protected static string|\UnitEnum|null $navigationGroup = 'Inhalte'; + protected static string|\UnitEnum|null $navigationGroup = 'Stammdaten'; protected static ?string $navigationLabel = 'Fachliche Säulen'; @@ -32,7 +32,7 @@ class PillarResource extends Resource protected static ?string $slug = 'saeulen'; - protected static ?int $navigationSort = 5; + protected static ?int $navigationSort = 1; public static function canViewAny(): bool { diff --git a/app/Filament/Resources/Practices/PracticeResource.php b/app/Filament/Resources/Practices/PracticeResource.php index 0ed11a9..fbad9fa 100644 --- a/app/Filament/Resources/Practices/PracticeResource.php +++ b/app/Filament/Resources/Practices/PracticeResource.php @@ -21,7 +21,7 @@ class PracticeResource extends CompositionKindResource protected static ?string $pluralModelLabel = 'Übungen'; - protected static ?int $navigationSort = 5; + protected static ?int $navigationSort = 2; public static function kind(): CompositionKind { diff --git a/app/Filament/Support/ListsCompositions.php b/app/Filament/Support/ListsCompositions.php index d66be81..143ee51 100644 --- a/app/Filament/Support/ListsCompositions.php +++ b/app/Filament/Support/ListsCompositions.php @@ -235,7 +235,7 @@ private function exerciseOrigin(Composition $composition, array $shinkan): strin $latest = $composition->versions->sortByDesc('number')->first(); $local = $latest !== null && CompositionMember::query()->where('composition_version_id', $latest->id)->where('origin', 'lokal')->exists(); - return $local ? 'Shinkan, lokal ergänzt' : 'Shinkan'; + return $local ? 'Shinkan, lokal bearbeitet' : 'Shinkan'; } /** diff --git a/docs/fachkonzept/uebungen-shinkan-feldzuordnung.md b/docs/fachkonzept/uebungen-shinkan-feldzuordnung.md index 9bf975b..cbc2a2f 100644 --- a/docs/fachkonzept/uebungen-shinkan-feldzuordnung.md +++ b/docs/fachkonzept/uebungen-shinkan-feldzuordnung.md @@ -46,6 +46,7 @@ ## 2. Verhalten beim Fassungswechsel | Titel | Gehört zur Übung, nicht zur Fassung. Er folgt der Quelle, **solange er lokal nicht geändert wurde**. Ein lokal geänderter Titel bleibt; die Vorschau nennt das. | | Kurzbeschreibung | Wie der Titel. | | Varianten | Neu hinzugekommene und entfallene Varianten sowie Umbenennungen und Änderungen werden in der Vorschau genannt. Die **Reihenfolge** der neuen Fassung folgt der Quelle. Eine Änderung der Reihenfolge wird in der Vorschau genannt. | +| Lokale Bearbeitung | Lokal bearbeitete Texte und Felder bleiben erhalten, solange die Quelle sie nicht ebenfalls geändert hat. Bei einer Änderung auf beiden Seiten entscheidet die Redaktion je Text oder Feld (lokale Fassung behalten oder Quellfassung übernehmen). Die bisherigen Fassungen bleiben immer unverändert. Lokal entfernte Quellabschnitte erscheinen mit der nächsten Übernahme wieder. | | Lokale Ergänzung | Bleibt bei der neuen Fassung erhalten. Entfällt die Quellvariante, der sie zugeordnet ist, legt die Redaktion die neue Zuordnung ausdrücklich fest (gemeinsamer Teil oder eine Variante). Ohne diese Festlegung wird nichts übernommen. | | Medienhinweise | Bleiben Quellenangabe. Ein geänderter Hinweis ändert keine lokale Fassung. | @@ -77,7 +78,7 @@ ## 4. Lücken bei der Übernahme verfügbarer Felder | `sequence_order` der Varianten | nicht als eigener Wert gespeichert, die Position folgt der Reihenfolge der Antwort | gleichwertig, solange der Katalog nach `sequence_order` sortiert liefert (`catalog_document` tut das) | | Variante ohne `execution_changes` | erzeugt keinen Abschnitt | gewollt; die Variante bleibt mit Name und Beschreibung sichtbar | | Titel und Kurzbeschreibung | folgen der Quelle nur, solange sie lokal nicht geändert wurden | siehe Abschnitt 2 | -| Abgleich mit lokalen Änderungen am Quelltext | Ein lokal bearbeiteter Quellabschnitt wird nicht erkannt, weil lokale Änderungen eine neue lokale Fassung mit eigenem Text sind und die Quellabschnitte unverändert bleiben | Bei der nächsten Übernahme gilt wieder der Quelltext, die Redaktion ergänzt lokal über eigene Bestandteile | +| Lokal bearbeitete Quellangaben | Eine importierte Übung ist eine Übung wie jede andere und wird im selben Editor bearbeitet und als neue Fassung gespeichert. Bei der nächsten Übernahme bleiben lokal bearbeitete Texte und Felder (Lernziel, Dauer, Ausstattung) erhalten, solange die Quelle sie nicht ebenfalls geändert hat. Haben beide geändert, legt die Redaktion fest, ob die lokale oder die Quellfassung gilt. | Die Vorschau nennt „Lokal bearbeitet, bleibt erhalten“ und fragt bei einem Konflikt nach. | ## 5. Offene Entscheidungen diff --git a/resources/views/filament/pages/uebernahme.blade.php b/resources/views/filament/pages/uebernahme.blade.php index 8451cc6..af81168 100644 --- a/resources/views/filament/pages/uebernahme.blade.php +++ b/resources/views/filament/pages/uebernahme.blade.php @@ -129,6 +129,19 @@

Medienhinweise der Quelle

Quellenangaben ohne Datei. Sie werden nicht ausgeliefert und begründen keine Nutzungsberechtigung: {{ implode(', ', $eintrag['media']) }}

@endif + @if ($eintrag['kept_local'] !== []) +

Lokal bearbeitet, bleibt erhalten: {{ implode(', ', $eintrag['kept_local']) }}. Die Quelle hat diese Angaben nicht geändert.

+ @endif + @foreach ($eintrag['text_conflicts'] as $konflikt) + + @endforeach @foreach ($eintrag['conflicts'] as $konflikt)