Behandle Übungen aus Shinkan wie jede Übung, ordne die Navigation neu
Deploy Test / test (push) Successful in 2m43s
Deploy Test / deploy (push) Successful in 26s

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 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-23 19:05:05 +01:00
1 parent bb08b9b3fa
commit 9140e731f9
12 files changed
+438 -59

No files matched your search

@@ -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';
+20 -2
View File
@@ -56,6 +56,9 @@ class Uebernahme extends Page
/** @var array<int|string, array<string, string>> Quellübung => (entfallene Quellvariante => neue Zuordnung) */
public array $reassign = [];
/** @var array<int|string, array<string, string>> Quellübung => (Text oder Feld => `lokal` oder `quelle`) */
public array $textChoice = [];
/** @var list<array<string, mixed>> */
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'],
@@ -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
{
@@ -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)
@@ -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
{
@@ -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
{
+1 -1
View File
@@ -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';
}
/**