Skip to content

Commit c330482

Browse files
committed
Fix open message provider
1 parent 3c935ad commit c330482

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mithril-aggregator/src/database/provider/open_message.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl SqLiteEntity for OpenMessageWithSingleSignatures {
439439
("protocol_message", "{:open_message:}.protocol_message", "text"),
440440
("is_certified", "{:open_message:}.is_certified", "bool"),
441441
("created_at", "{:open_message:}.created_at", "text"),
442-
("single_signatures", "json_group_array(json_object('signer_id', {:single_signature:}.signer_id, 'signature', {:single_signature:}.signature, 'won_indexes', {:single_signature:}.lottery_indexes))", "text")
442+
("single_signatures", "case when {:single_signature:}.signer_id is null then json('[]') else json_group_array(json_object('party_id', {:single_signature:}.signer_id, 'signature', {:single_signature:}.signature, 'indexes', json({:single_signature:}.lottery_indexes))) end", "text")
443443
])
444444
}
445445
}
@@ -509,7 +509,7 @@ mod tests {
509509
]);
510510

511511
assert_eq!(
512-
"open_message.open_message_id as open_message_id, open_message.epoch_setting_id as epoch_setting_id, open_message.beacon as beacon, open_message.signed_entity_type_id as signed_entity_type_id, open_message.protocol_message as protocol_message, open_message.is_certified as is_certified, open_message.created_at as created_at, json_group_array(json_object('signer_id', single_signature.signer_id, 'signature', single_signature.signature, 'won_indexes', single_signature.lottery_indexes)) as single_signatures".to_string(),
512+
"open_message.open_message_id as open_message_id, open_message.epoch_setting_id as epoch_setting_id, open_message.beacon as beacon, open_message.signed_entity_type_id as signed_entity_type_id, open_message.protocol_message as protocol_message, open_message.is_certified as is_certified, open_message.created_at as created_at, case when single_signature.signer_id is null then json('[]') else json_group_array(json_object('party_id', single_signature.signer_id, 'signature', single_signature.signature, 'indexes', json(single_signature.lottery_indexes))) end as single_signatures".to_string(),
513513
projection.expand(aliases)
514514
)
515515
}

0 commit comments

Comments
 (0)