Skip to content

Commit e6cbd6d

Browse files
committed
treat YYYY-MM-00 and YYYY-00-00 as unknown dates/months
1 parent 4d4199c commit e6cbd6d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

RelistenApi/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static IWebHost BuildWebHost(string[] args, int port)
3535

3636
if (!string.IsNullOrEmpty(sentryDsn))
3737
{
38-
Console.WriteLine($"Configuring Sentry: ${sentryDsn}");
38+
Console.WriteLine($"Configuring Sentry: {sentryDsn}");
3939
// Add the following line:
4040
host.UseSentry(o =>
4141
{

RelistenApi/Services/Importers/ArchiveOrgImporter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,12 @@ private Source CreateSourceForMetadata(
496496
// thanks to this trouble child: https://archive.org/metadata/lotus2011-16-07.lotus2011-16-07_Neumann
497497
private string FixDisplayDate(Metadata meta)
498498
{
499+
if (meta.date.Contains("00"))
500+
{
501+
// XX is the preferred unknown date identifier
502+
return meta.date.Replace("00", "XX");
503+
}
504+
499505
// 1970-03-XX or 1970-XX-XX which is okay because it is handled by the rebuild
500506
if (meta.date.Contains('X'))
501507
{

RelistenApi/Services/Importers/ImporterBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ INSERT INTO
342342
--array_agg(setlist_show.date),
343343
source.artist_id,
344344
COALESCE(setlist_show.date, CASE
345+
WHEN MIN(source.display_date) LIKE '%-XX-XX%' THEN to_date(LEFT(MIN(source.display_date), 10), 'YYYY')
346+
WHEN MIN(source.display_date) LIKE '%-XX%' THEN to_date(LEFT(MIN(source.display_date), 10), 'YYYY-MM')
345347
WHEN MIN(source.display_date) LIKE '%X%' THEN to_date(LEFT(MIN(source.display_date), 10), 'YYYY')
346348
ELSE to_date(LEFT(MIN(source.display_date), 10), 'YYYY-MM-DD')
347349
END) as date,

0 commit comments

Comments
 (0)