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

Add infrastructure support for suggesting score. #426

Closed
toebes opened this issue Dec 10, 2023 · 2 comments
Closed

Add infrastructure support for suggesting score. #426

toebes opened this issue Dec 10, 2023 · 2 comments

Comments

@toebes
Copy link
Owner

toebes commented Dec 10, 2023

Create a new routine
genScoreRange() : number[] {
}

First number is the suggested score, Next two numbers are the low and high for the range.

@toebes
Copy link
Owner Author

toebes commented Dec 10, 2023

Once this is done create issues to add genScoreRange() to all the ciphers.

@toebes
Copy link
Owner Author

toebes commented Dec 18, 2023

There are three things that each cipher needs to do:

  1. Add a routine like
/**
 * Generate the recommended score and score ranges for a cipher
 * @returns Computed score ranges for the cipher
 */
public genScoreRange(): suggestedData {
   return { suggested: 0, min: 0, max: 0 }
}

which returns the suggested score and an min/max range for what the score should fall into. Note that if max <= min then the range is ignored and only a suggested score is given.
2. Add a routine like

/**
 * Determine what to tell the user about how the score has been computed
 * @param suggesteddata Data calculated for the score range
 * @returns HTML String to display in the suggested question dialog
 */
public genSamplePointsText(suggesteddata: suggestedData): string {
   return `<p>We suggest you try a score of ${suggesteddata.suggested}</p>`
}

which returns an HTML string that is posted directly into the dialog. Note that the suggestedData from the genScoreRange() routine is passed into this routine. If there is additional information you need passed in (such as is done for the Aristocrat one) then there is a private field in the suggestedData structure that can hold any.
3. In the cmdButtons, add this.questionButton,this.pointsButton, before this.guidanceButton, so that the buttons appear on the UI.

    public cmdButtons: JTButtonItem[] = [
        this.saveButton,
        this.undocmdButton,
        this.redocmdButton,
        this.questionButton,
        this.pointsButton,
        this.guidanceButton,
        { title: 'Reset', color: 'warning', id: 'reset' },
    ];

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

No branches or pull requests

1 participant