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

Rename whenIn to be less misleading #8

Open
AndyStabler opened this issue Dec 3, 2016 · 0 comments
Open

Rename whenIn to be less misleading #8

AndyStabler opened this issue Dec 3, 2016 · 0 comments
Labels

Comments

@AndyStabler
Copy link
Owner

AndyStabler commented Dec 3, 2016

The more I think about whenIn(cohort[, selector], callback) the more I think it's misleading. Reading whenIn suggests that we can call this function before the enrolment has occurred, e.g.

test.withCohorts(["contro", "treatment"])
.whenIn("treatment", function() { ... })
.enrol();

This looks like it should work because when implies that we'll check the cohort at some point in the future (whenever the user is enrolled). However, it will not work because whenIn looks at the cohort the user is currently enrolled into.

To make this more obvious I think we should rename whenIn to something like:

ifCohortIs, ifCohortMatches, ifEnrolledInto.

Open to suggestions- we just need to get across that this method will execute some callback when the cohort matches.

Or we could alter the code so that the order the methods are called in is not important. I like this idea the best.

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