Double check validations on learners tested

https://praekelt.atlassian.net/browse/RZ-20?jql=project%20%3D%20RZ%20AND%20resolution%20%3D%20Unresolved%20AND%20priority%20%3D%20Critical%20ORDER%20BY%20key%20DESC
I just did - not sure if you're finished with review but pushed the change.


On Fri, Jun 27, 2014 at 10:16 AM, Mike Jones <notifications@github.com>
wrote:

> In js_sandbox/lib/go-rts-zambia.js:
>
> > +                return self.check_valid_number(content);
> > +            };
> > +        }
> > +
> > +        if (gender === 'boys') {
> > +            total_state = "perf_learner_boys_total";
> > +        } else {
> > +            total_state = "perf_learner_girls_total";
> > +        }
> > +
> > +        var total = parseInt(im.get_user_answer(total_state),10);
> > +        var array_of_answers = self.make_array_of_answers(states_completed);
> > +        var array_total = self.calc_array_total(array_of_answers);
> > +        var msg;
> > +
> > +        if (must_equal) {
>
> You can DRY this with:
> if (must_equal && (total === array_total) || !must_equal && (total >
> array_total)) {
> # make freetext
> } else {
> # make error state
> }
>
> see: https://gist.github.com/imsickofmaps/049af3fdd23d05787bb6
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/praekelt/go-rts-zambia/pull/102/files#r14283390>.
>