Spieltag-Assistent füllt „Locations Taken and Shown“ immer aus
- Ortsdetail (Stadion), Stadt, Bundesland, Land, Ländercode und Weltregion kommen aus dem Spielort und werden immer angewendet – auch wenn die Basis-Vorlage den Block nicht hat - Spielort hat eine Weltregion (Standard „Europa“), editierbar im Assistenten - Venue tolerant gelesen (gespeicherte Stadien bleiben erhalten) - Agentur-Check: der Block lässt sich als Pflichtfelder auswählen („… (Aufnahmeort)“) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
278967a358
commit
3a2c8253ac
4 files changed
+43
-12
No files matched your search
@@ -367,7 +367,9 @@ struct PreflightSettings: View {
|
|||||||
/// fields offered as "Pflichtfeld"
|
/// fields offered as "Pflichtfeld"
|
||||||
private static let candidates = ["caption", "headline", "creator", "copyright", "credit", "source", "event",
|
private static let candidates = ["caption", "headline", "creator", "copyright", "credit", "source", "event",
|
||||||
"city", "sublocation", "state", "country", "countryCode", "dateCreated",
|
"city", "sublocation", "state", "country", "countryCode", "dateCreated",
|
||||||
"keywords", "objectName", "captionWriter"]
|
"keywords", "objectName", "captionWriter",
|
||||||
|
// "Locations Taken and Shown" (many agencies require it)
|
||||||
|
"lcSublocation", "lcCity", "lcState", "lcCountry", "lcCountryCode", "lcWorldRegion"]
|
||||||
|
|
||||||
private var opts: Binding<PreflightOptions> { $state.settings.preflight }
|
private var opts: Binding<PreflightOptions> { $state.settings.preflight }
|
||||||
|
|
||||||
@@ -377,7 +379,7 @@ struct PreflightSettings: View {
|
|||||||
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())], alignment: .leading, spacing: 8) {
|
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())], alignment: .leading, spacing: 8) {
|
||||||
ForEach(Self.candidates, id: \.self) { id in
|
ForEach(Self.candidates, id: \.self) { id in
|
||||||
if let f = IPTCField.byID[id] {
|
if let f = IPTCField.byID[id] {
|
||||||
Toggle(f.label, isOn: Binding(
|
Toggle(f.section == .locationCreated ? "\(f.label) (Aufnahmeort)" : f.label, isOn: Binding(
|
||||||
get: { state.settings.preflight.requiredFields.contains(id) },
|
get: { state.settings.preflight.requiredFields.contains(id) },
|
||||||
set: { on in
|
set: { on in
|
||||||
state.settings.preflight.requiredFields.removeAll { $0 == id }
|
state.settings.preflight.requiredFields.removeAll { $0 == id }
|
||||||
|
|||||||
@@ -315,6 +315,8 @@ struct SpieltagView: View {
|
|||||||
TextField("Bundesland", text: v.state).textFieldStyle(.roundedBorder)
|
TextField("Bundesland", text: v.state).textFieldStyle(.roundedBorder)
|
||||||
TextField("Land", text: v.country).textFieldStyle(.roundedBorder)
|
TextField("Land", text: v.country).textFieldStyle(.roundedBorder)
|
||||||
TextField("DEU", text: v.countryCode).textFieldStyle(.roundedBorder).frame(width: 56)
|
TextField("DEU", text: v.countryCode).textFieldStyle(.roundedBorder).frame(width: 56)
|
||||||
|
TextField("Weltregion", text: v.worldRegion).textFieldStyle(.roundedBorder).frame(width: 90)
|
||||||
|
.help("Locations Taken and Shown → World Region")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,27 @@ public struct Venue: Codable, Hashable, Sendable {
|
|||||||
public var state: String = "" // "Niedersachsen"
|
public var state: String = "" // "Niedersachsen"
|
||||||
public var country: String = "Deutschland"
|
public var country: String = "Deutschland"
|
||||||
public var countryCode: String = "DEU"
|
public var countryCode: String = "DEU"
|
||||||
|
/// "Locations Taken and Shown" → World Region (agencies require the complete block)
|
||||||
|
public var worldRegion: String = "Europa"
|
||||||
|
|
||||||
public init(name: String = "", city: String = "", state: String = "", country: String = "Deutschland", countryCode: String = "DEU") {
|
public init(name: String = "", city: String = "", state: String = "", country: String = "Deutschland",
|
||||||
|
countryCode: String = "DEU", worldRegion: String = "Europa") {
|
||||||
self.name = name; self.city = city; self.state = state; self.country = country; self.countryCode = countryCode
|
self.name = name; self.city = city; self.state = state; self.country = country; self.countryCode = countryCode
|
||||||
|
self.worldRegion = worldRegion
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CodingKeys: String, CodingKey { case name, city, state, country, countryCode, worldRegion }
|
||||||
|
|
||||||
|
/// Tolerant: venues saved before a field existed keep their stadium.
|
||||||
|
public init(from decoder: Decoder) throws {
|
||||||
|
let c = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
let d = Venue()
|
||||||
|
name = (try? c.decode(String.self, forKey: .name)) ?? d.name
|
||||||
|
city = (try? c.decode(String.self, forKey: .city)) ?? d.city
|
||||||
|
state = (try? c.decode(String.self, forKey: .state)) ?? d.state
|
||||||
|
country = (try? c.decode(String.self, forKey: .country)) ?? d.country
|
||||||
|
countryCode = (try? c.decode(String.self, forKey: .countryCode)) ?? d.countryCode
|
||||||
|
worldRegion = (try? c.decode(String.self, forKey: .worldRegion)) ?? d.worldRegion
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isEmpty: Bool { name.isEmpty && city.isEmpty }
|
public var isEmpty: Bool { name.isEmpty && city.isEmpty }
|
||||||
@@ -283,7 +301,9 @@ public enum SpieltagGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static let generatedFields = ["headline", "event", "caption", "city", "sublocation", "state", "country",
|
public static let generatedFields = ["headline", "event", "caption", "city", "sublocation", "state", "country",
|
||||||
"countryCode", "keywords", "dateCreated"]
|
"countryCode", "keywords", "dateCreated",
|
||||||
|
// "Locations Taken and Shown" – agencies reject images without it
|
||||||
|
"lcSublocation", "lcCity", "lcState", "lcCountry", "lcCountryCode", "lcWorldRegion"]
|
||||||
|
|
||||||
/// The IPTC template of the match: base template (creator, copyright, …) + everything generated.
|
/// The IPTC template of the match: base template (creator, copyright, …) + everything generated.
|
||||||
public static func makeTemplate(match: MatchPlan, home: TeamProfile, away: TeamProfile, competition: Competition?,
|
public static func makeTemplate(match: MatchPlan, home: TeamProfile, away: TeamProfile, competition: Competition?,
|
||||||
@@ -303,14 +323,14 @@ public enum SpieltagGenerator {
|
|||||||
v.text["countryCode"] = match.venue.countryCode.isEmpty ? nil : match.venue.countryCode
|
v.text["countryCode"] = match.venue.countryCode.isEmpty ? nil : match.venue.countryCode
|
||||||
v.lists["keywords"] = keywords(match: match, home: home, away: away, competition: competition, patterns: patterns, ctx: ctx)
|
v.lists["keywords"] = keywords(match: match, home: home, away: away, competition: competition, patterns: patterns, ctx: ctx)
|
||||||
v.text["dateCreated"] = "{capturetime}"
|
v.text["dateCreated"] = "{capturetime}"
|
||||||
// "Location created" only if the base template uses it – then it must not keep the old stadium
|
// "Locations Taken and Shown" (Location Created) – always filled, the agency needs the complete block
|
||||||
if t.values.text["lcCity"] != nil || t.values.text["lcSublocation"] != nil {
|
func set(_ id: String, _ value: String) { v.text[id] = value.isEmpty ? nil : value }
|
||||||
v.text["lcCity"] = match.venue.city
|
set("lcSublocation", match.venue.name)
|
||||||
v.text["lcSublocation"] = match.venue.name
|
set("lcCity", match.venue.city)
|
||||||
v.text["lcState"] = match.venue.state
|
set("lcState", match.venue.state)
|
||||||
v.text["lcCountry"] = match.venue.country
|
set("lcCountry", match.venue.country)
|
||||||
v.text["lcCountryCode"] = match.venue.countryCode
|
set("lcCountryCode", match.venue.countryCode)
|
||||||
}
|
set("lcWorldRegion", match.venue.worldRegion.isEmpty ? (t.values.text["lcWorldRegion"] ?? "") : match.venue.worldRegion)
|
||||||
t.values = v
|
t.values = v
|
||||||
t.dateFromCapture = true
|
t.dateFromCapture = true
|
||||||
if var applied = t.appliedFields {
|
if var applied = t.appliedFields {
|
||||||
|
|||||||
@@ -325,6 +325,13 @@ final class SpieltagTests: XCTestCase {
|
|||||||
XCTAssertTrue(t.appliedFields?.contains("headline") == true)
|
XCTAssertTrue(t.appliedFields?.contains("headline") == true)
|
||||||
XCTAssertTrue(t.appliedFields?.contains("creator") == true)
|
XCTAssertTrue(t.appliedFields?.contains("creator") == true)
|
||||||
XCTAssertNotEqual(t.id, base.id)
|
XCTAssertNotEqual(t.id, base.id)
|
||||||
|
// "Locations Taken and Shown" always complete (agency requirement), even if the base has none
|
||||||
|
for id in ["lcSublocation", "lcCity", "lcState", "lcCountry", "lcCountryCode", "lcWorldRegion"] {
|
||||||
|
XCTAssertTrue(t.appliedFields?.contains(id) == true, id)
|
||||||
|
}
|
||||||
|
XCTAssertEqual(t.values.text["lcSublocation"], m.venue.name)
|
||||||
|
XCTAssertEqual(t.values.text["lcCity"], m.venue.city)
|
||||||
|
XCTAssertEqual(t.values.text["lcWorldRegion"], "Europa")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user