@@ -143,6 +143,10 @@ insertOffChainVoteResults trce resultQueue = do
143
143
OffChainVoteResultMetadata md accessors -> do
144
144
mocvdId <- DB. insertOffChainVoteData md
145
145
whenJust mocvdId $ \ ocvdId -> do
146
+ whenJust (offChainVoteGovAction accessors ocvdId) $ \ ocvga ->
147
+ void $ DB. insertOffChainVoteGovActionData ocvga
148
+ whenJust (offChainVoteDrep accessors ocvdId) $ \ ocvdr ->
149
+ void $ DB. insertOffChainVoteDrepData ocvdr
146
150
DB. insertOffChainVoteAuthors $ offChainVoteAuthors accessors ocvdId
147
151
DB. insertOffChainVoteReference $ offChainVoteReferences accessors ocvdId
148
152
DB. insertOffChainVoteExternalUpdate $ offChainVoteExternalUpdates accessors ocvdId
@@ -275,22 +279,20 @@ fetchOffChainVoteData _tracer manager time oVoteWorkQ =
275
279
DB. OffChainVoteData
276
280
{ DB. offChainVoteDataLanguage = Vote. getLanguage offChainData
277
281
, DB. offChainVoteDataComment = Vote. textValue <$> Vote. comment minimalBody
278
- , DB. offChainVoteDataTitle = Vote. getTitle offChainData
279
- , DB. offChainVoteDataAbstract = Vote. getAbstract offChainData
280
- , DB. offChainVoteDataMotivation = Vote. getMotivation offChainData
281
- , DB. offChainVoteDataRationale = Vote. getRationale offChainData
282
282
, DB. offChainVoteDataBytes = sovaBytes sVoteData
283
283
, DB. offChainVoteDataHash = sovaHash sVoteData
284
284
, DB. offChainVoteDataJson = sovaJson sVoteData
285
285
, DB. offChainVoteDataVotingAnchorId = oVoteWqReferenceId oVoteWorkQ
286
286
, DB. offChainVoteDataWarning = sovaWarning sVoteData
287
287
, DB. offChainVoteDataIsValid = Nothing
288
288
}
289
+ gaF ocvdId = mkGovAction ocvdId offChainData
290
+ drepF ocvdId = mkDrep ocvdId offChainData
289
291
authorsF ocvdId = map (mkAuthor ocvdId) $ Vote. getAuthors offChainData
290
292
referencesF ocvdId = map (mkReference ocvdId) $ mListToList $ Vote. references minimalBody
291
293
externalUpdatesF ocvdId = map (mkexternalUpdates ocvdId) $ mListToList $ Vote. externalUpdates minimalBody
292
294
in
293
- OffChainVoteResultMetadata vdt (OffChainVoteAccessors authorsF referencesF externalUpdatesF)
295
+ OffChainVoteResultMetadata vdt (OffChainVoteAccessors gaF drepF authorsF referencesF externalUpdatesF)
294
296
Left err ->
295
297
OffChainVoteResultError $
296
298
DB. OffChainVoteFetchError
@@ -299,6 +301,31 @@ fetchOffChainVoteData _tracer manager time oVoteWorkQ =
299
301
, DB. offChainVoteFetchErrorFetchTime = Time. posixSecondsToUTCTime time
300
302
, DB. offChainVoteFetchErrorRetryCount = retryCount (oVoteWqRetry oVoteWorkQ)
301
303
}
304
+ mkGovAction ocvdId = \ case
305
+ Vote. OffChainVoteDataGa dt ->
306
+ Just $
307
+ DB. OffChainVoteGovActionData
308
+ { DB. offChainVoteGovActionDataOffChainVoteDataId = ocvdId
309
+ , DB. offChainVoteGovActionDataTitle = Vote. textValue $ Vote. title $ Vote. body dt
310
+ , DB. offChainVoteGovActionDataAbstract = Vote. textValue $ Vote. abstract $ Vote. body dt
311
+ , DB. offChainVoteGovActionDataMotivation = Vote. textValue $ Vote. motivation $ Vote. body dt
312
+ , DB. offChainVoteGovActionDataRationale = Vote. textValue $ Vote. rationale $ Vote. body dt
313
+ }
314
+ _ -> Nothing
315
+
316
+ mkDrep ocvdId = \ case
317
+ Vote. OffChainVoteDataDr dt ->
318
+ Just $
319
+ DB. OffChainVoteDrepData
320
+ { DB. offChainVoteDrepDataOffChainVoteDataId = ocvdId
321
+ , DB. offChainVoteDrepDataPaymentAddress = Vote. textValue <$> Vote. paymentAddress (Vote. body dt)
322
+ , DB. offChainVoteDrepDataGivenName = Vote. textValue $ Vote. givenName $ Vote. body dt
323
+ , DB. offChainVoteDrepDataObjectives = Vote. textValue <$> Vote. objectives (Vote. body dt)
324
+ , DB. offChainVoteDrepDataMotivations = Vote. textValue <$> Vote. motivations (Vote. body dt)
325
+ , DB. offChainVoteDrepDataQualifications = Vote. textValue <$> Vote. qualifications (Vote. body dt)
326
+ }
327
+ _ -> Nothing
328
+
302
329
mkAuthor ocvdId au =
303
330
DB. OffChainVoteAuthor
304
331
{ DB. offChainVoteAuthorOffChainVoteDataId = ocvdId
0 commit comments