diff options
author | pacien | 2020-01-06 11:05:18 +0100 |
---|---|---|
committer | pacien | 2020-01-06 11:05:18 +0100 |
commit | f1ffff03ad6bf86c32c3af90393bd53ca21ad4db (patch) | |
tree | efbd39895ded4d48fdc86d4fa932a15afb943e64 /compiler/src/Resource.hs | |
parent | 03d39102ba55cda7cbe80fcdeb9b250caaa70bd0 (diff) | |
download | ldgallery-f1ffff03ad6bf86c32c3af90393bd53ca21ad4db.tar.gz |
compiler: rename date field to more explicit datetime
Diffstat (limited to 'compiler/src/Resource.hs')
-rw-r--r-- | compiler/src/Resource.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/src/Resource.hs b/compiler/src/Resource.hs index 53d61ac..29906b7 100644 --- a/compiler/src/Resource.hs +++ b/compiler/src/Resource.hs | |||
@@ -78,7 +78,7 @@ instance ToJSON GalleryItemProps where | |||
78 | 78 | ||
79 | data GalleryItem = GalleryItem | 79 | data GalleryItem = GalleryItem |
80 | { title :: String | 80 | { title :: String |
81 | , date :: ZonedTime | 81 | , datetime :: ZonedTime |
82 | , description :: String | 82 | , description :: String |
83 | , tags :: [Tag] | 83 | , tags :: [Tag] |
84 | , path :: Path | 84 | , path :: Path |
@@ -109,7 +109,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in | |||
109 | fileModTime <- lastModTime path | 109 | fileModTime <- lastModTime path |
110 | return GalleryItem | 110 | return GalleryItem |
111 | { title = itemTitle | 111 | { title = itemTitle |
112 | , date = fromMaybe fileModTime $ Input.date sidecar | 112 | , datetime = fromMaybe fileModTime $ Input.datetime sidecar |
113 | , description = optMeta description "" | 113 | , description = optMeta description "" |
114 | , tags = (optMeta tags []) ++ implicitParentTags parents | 114 | , tags = (optMeta tags []) ++ implicitParentTags parents |
115 | , path = parents </ itemTitle | 115 | , path = parents </ itemTitle |
@@ -129,7 +129,7 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in | |||
129 | dirModTime <- lastModTime path | 129 | dirModTime <- lastModTime path |
130 | return GalleryItem | 130 | return GalleryItem |
131 | { title = itemTitle | 131 | { title = itemTitle |
132 | , date = fromMaybe dirModTime $ mostRecentChildModTime processedItems | 132 | , datetime = fromMaybe dirModTime $ mostRecentChildModTime processedItems |
133 | , description = "" | 133 | , description = "" |
134 | , tags = (aggregateChildTags processedItems) ++ implicitParentTags parents | 134 | , tags = (aggregateChildTags processedItems) ++ implicitParentTags parents |
135 | , path = itemPath | 135 | , path = itemPath |
@@ -148,10 +148,10 @@ buildGalleryTree processItem processThumbnail tagsFromDirectories galleryName in | |||
148 | 148 | ||
149 | mostRecentChildModTime :: [GalleryItem] -> Maybe ZonedTime | 149 | mostRecentChildModTime :: [GalleryItem] -> Maybe ZonedTime |
150 | mostRecentChildModTime = | 150 | mostRecentChildModTime = |
151 | maximumByMay comparingDates . map (date::(GalleryItem -> ZonedTime)) | 151 | maximumByMay comparingTime . map (datetime::(GalleryItem -> ZonedTime)) |
152 | 152 | ||
153 | comparingDates :: ZonedTime -> ZonedTime -> Ordering | 153 | comparingTime :: ZonedTime -> ZonedTime -> Ordering |
154 | comparingDates l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r) | 154 | comparingTime l r = compare (zonedTimeToUTC l) (zonedTimeToUTC r) |
155 | 155 | ||
156 | aggregateChildTags :: [GalleryItem] -> [Tag] | 156 | aggregateChildTags :: [GalleryItem] -> [Tag] |
157 | aggregateChildTags = unique . concatMap (\item -> tags (item::GalleryItem)) | 157 | aggregateChildTags = unique . concatMap (\item -> tags (item::GalleryItem)) |