Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill missing collection ids #692

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion NineChronicles.DataProvider/RenderSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,12 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken)
var outputState = new World(_blockChainStates.GetWorldState(ev.OutputState));
var collectionSheet = outputState.GetSheet<CollectionSheet>();
var avatar = MySqlStore.GetAvatar(activateCollection.AvatarAddress, true);
foreach (var (collectionId, materials) in activateCollection.CollectionData)

// check chain state ids to fill in missing collection data
var collectionState = outputState.GetCollectionState(activateCollection.AvatarAddress);
var existIds = avatar.ActivateCollections.Select(i => i.Id);
var targetIds = collectionState.Ids.Except(existIds);
foreach (var collectionId in targetIds)
{
var row = collectionSheet[collectionId];
var options = new List<CollectionOptionModel>();
Expand Down Expand Up @@ -1429,6 +1434,10 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken)

MySqlStore.UpdateAvatar(avatar);
}
else
{
Log.Error($"ActivateColleciton RenderSubscriber: {ev.Exception?.Message}");
}
});

return Task.CompletedTask;
Expand Down
Loading