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

Championship arena GQL update #1415

Open
wants to merge 58 commits into
base: development
Choose a base branch
from

Conversation

TarogStar
Copy link
Contributor

I added some additional models, added the chain tip index to the StateContext, and inherited from IAccountStateDelta to allow all of the extension methods to get the arena data. The old weekly arena is still available to get data for older arena rounds.

Copy link
Member

@ipdae ipdae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. I have a few questions, so I left a comment.

using Bencodex.Types;
using Libplanet;
using Libplanet.Action;
using Libplanet.Assets;

namespace NineChronicles.Headless.GraphTypes.States
{
public class StateContext
public class StateContext : IAccountStateDelta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to inherit from IAccountStateDelta? I wonder where it is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IAccountStateDelta allows using GetSheets, TryGetArenaParticipants, TryGetArenaInformation, TryGetArenaScore Would it make sense to just import those methods and duplicate them in the StateContext?

@@ -54,7 +54,8 @@ public StandaloneQuery(StandaloneContext standaloneContext, IConfiguration confi

return new StateContext(
chain.ToAccountStateGetter(blockHash),
chain.ToAccountBalanceGetter(blockHash)
chain.ToAccountBalanceGetter(blockHash),
chain.Tip.Index
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even when a block hash is given as an argument, but block index always use latest index. it may cause confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted a new commit to address the issue to use the right block index.

{
AccountStateGetter = accountStateGetter;
AccountBalanceGetter = accountBalanceGetter;
ChainTipIndex = chainTipIndex;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is chainTipIndex used? I can't see where it's used, is there a reason it was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like I didn't get everything over to this branch previously. I needed the index to determine if 0 tickets is actually 0 or should be 8 and they haven't battled since the reset. I have now included the code that uses the index.

arenaInfo.Ticket = arenaInformation.Ticket;
arenaInfo.Lose = arenaInformation.Lose;
arenaInfo.Score = arenaScore.Score;
arenaInformations.Add(arenaInfo);
Copy link
Contributor

@boscohyun boscohyun Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to sorting this arenaInformations same with client, and check this function.

  • Ranking is determined by score.
  • The same score is displayed in the same rank.
    • The same rank at this time is the sum of the number of equal ranks from the previous rank.
  • The next rank of the same rank is the next rank of the same rank.

e.g., You can check what we expect with Data source and Unit test

And we will move this ranking function from 9c to lib9c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the proper ranking and sorting to the PR. Will need to modify when the function moves to lib9c to keep it consistent.

Copy link
Member

@ipdae ipdae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can't understand ordering of ChampionArenaInfo please check @boscohyun

@TarogStar
Copy link
Contributor Author

I ran some tests and made sure that rank was exposed and properly calculated vs client and corrected some issues with the code and also merged in the latest from the development branch.

TarogStar and others added 27 commits July 28, 2022 16:26
Bump Lib9c v100361

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEESrITiRCjYKFI2nN2C4+hGGGQlhQFAmPczjcACgkQC4+hGGGQ
# lhTh9BAAiOhler1K9YKEKOOxuSJ2u4HsCvqTqF8C42drnx75TADUG8lS720QlA4c
# B0TlzTxCkohCDGjQ74a4DPddzh9j8WH+IOlXEyGLbLy+M8r3oRhcePbs3pv/rTCU
# Ym1t0dvWkgHB5RbGTDrzKV/AHM3PVoM6UI4HbIkbBVk7Z3vDzHM8KNqfT1MX7R2q
# oxRwbdQoiFuZPzu5HADtvIPS6ObZy12/l4JBGCaDjImmFFeogaT3gKTyYPKm20r0
# NHtWlE07Rg52qdlWofFxhDQ8PWQ6bJWkObQB534Qd3CjUdKPXXSU8AjK5pOA2yQH
# aURgoJRD76lY5ph2GK8ASdj49KNZuF4+/ZE/6bDEjxqz/UepGq/PFCSm4z97GAmW
# V7EIQ2FtKVnoCsVDIYv9eU6rexK7grs5ghvYQegG/yYIDGcrACopNe8DnFa32tPc
# /c2+N77WZ8braeFsw70ojKFaDzkLtZXWwARrtTcTmlDcd8I3jupbTazTrbGhIzPQ
# v+XW5DupUY9QNEn4KNhpopyApE3MyAo4DNrsW9lEjCPjVZBGF5IG5MTIRSFKlj/2
# HeBZSJ1WSDXDifc/9tTRrhTCDjCv6bvOO7vsT90a4C+W8MASwA7/n1gq6sQUyOaP
# QYBTiOLHBEMFSXeVRVPbGsXAxOgsJmHwyey/kyoEzfiYzLXzheU=
# =jlhk
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Feb  3 18:04:55 2023
# gpg:                using RSA key 4AB2138910A360A148DA73760B8FA11861909614
# gpg: Can't check signature: No public key
@pull-request-quantifier-deprecated

This PR has 245 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Large
Size       : +240 -5
Percentile : 64.5%

Total files changed: 9

Change summary by file extension:
.sln : +0 -0
.cs : +239 -4
Lib9c : +1 -1

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants