@@ -79,6 +79,7 @@ public async Task<object> Any(SyncTasks request)
7979 {
8080 // Update temporal scores + save all creatives with Artifacts that have changed
8181 var sw = Stopwatch . StartNew ( ) ;
82+ var now = DateTime . UtcNow ;
8283 var msgs = new List < string > ( ) ;
8384 void log ( string message , params object [ ] args )
8485 {
@@ -133,6 +134,8 @@ void log(string message, params object[] args)
133134 LikesCount = album . LikesCount ,
134135 SearchCount = album . SearchCount ,
135136 Score = album . Score ,
137+ ModifiedBy = Users . System . Id . ToString ( ) ,
138+ ModifiedDate = now ,
136139 } , x => x . Id == album . Id ) ;
137140 Updated . AlbumScore ( album . Id ) ;
138141 }
@@ -167,10 +170,11 @@ void log(string message, params object[] args)
167170 Scores . LoadAnalytics ( dbAnalytics ) ;
168171
169172 var count = 0 ;
170- var allCreatives = await Db . LoadSelectAsync ( Db . From < Creative > ( ) ) ;
173+ var allCreatives = await Db . SelectAsync ( Db . From < Creative > ( ) ) ;
171174 foreach ( var creative in allCreatives )
172175 {
173- foreach ( var artifact in creative . Artifacts . OrEmpty ( ) )
176+ var creativeArtifacts = await Db . SelectAsync ( Db . From < Artifact > ( ) . Where ( x => x . CreativeId == creative . Id ) ) ;
177+ foreach ( var artifact in creativeArtifacts )
174178 {
175179 var needsUpdating = Scores . PopulateArtifactScores ( artifact ) || Scores . PopulateTemporalScore ( artifact ) ;
176180 if ( needsUpdating )
@@ -183,7 +187,9 @@ void log(string message, params object[] args)
183187 DownloadsCount = artifact . DownloadsCount ,
184188 SearchCount = artifact . SearchCount ,
185189 Score = artifact . Score ,
186- } , x => x . Id == artifact . Id ) ;
190+ ModifiedBy = Users . System . Id . ToString ( ) ,
191+ ModifiedDate = now ,
192+ } , x => x . Id == artifact . Id ) ;
187193 Updated . ArtifactIds . Add ( artifact . Id ) ;
188194 }
189195 }
@@ -204,6 +210,8 @@ void log(string message, params object[] args)
204210 LikesCount = album . LikesCount ,
205211 SearchCount = album . SearchCount ,
206212 Score = album . Score ,
213+ ModifiedBy = Users . System . Id . ToString ( ) ,
214+ ModifiedDate = now ,
207215 } , x => x . Id == album . Id ) ;
208216 }
209217 }
0 commit comments