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

Infinite Recharge: Improve error checking between Color Wheel and Power Cell Tracker on match creation #2

Open
TheAnnalyst opened this issue Dec 23, 2020 · 1 comment
Labels

Comments

@TheAnnalyst
Copy link
Member

TheAnnalyst commented Dec 23, 2020

Currently, it's possible to construct an InfiniteRechargeMatch that you cannot then load from the SQL backend.

const frc = require('frc-scouting');
const backend = new frc.SQLBackend(new frc.InfiniteRecharge.InfiniteRechargeSQL(':memory:'));

const cells = new frc.InfiniteRecharge.PowerCellTracker({
    LOW: {auto: 0, teleop: 0},
    INNER: {auto: 0, teleop: 0},
    OUTER: {auto: 0, teleop: 0},
}, true);
const wheel = new frc.InfiniteRecharge.ColorWheel('SPECIFIC_COLOR');
const match = new frc.InfiniteRecharge.InfiniteRechargeMatch(1, 'test', 1, 'RED', {powerCells: cells, colorWheel: wheel}); 

backend.saveMatch(match);
backend.getMatchByNumber(1); // throws an error
@TheAnnalyst TheAnnalyst added help wanted Extra attention is needed good first issue Good for newcomers labels Dec 23, 2020
@TheAnnalyst
Copy link
Member Author

(This should be an easy bug for anyone [even new programmers, especially new programmers] to fix; it just requires moving the validation logic out of the PowerCellTracker and ColorWheel constructors, and into the InfiniteRechargeMatch constructor.)

@TheAnnalyst TheAnnalyst added infinite-recharge and removed help wanted Extra attention is needed labels Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant