data-ensures are not working properly #79

Closed
sophiebits opened this Issue Jun 1, 2011 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

sophiebits commented Jun 1, 2011

For example, look at:

age_word_problems.html?problem=solve-single-4

B is supposed to be at most 60.

Contributor

sophiebits commented Jun 1, 2011

This was also broken by @jochu's new templating (0c968c4):

Contributor

jochu commented Jun 1, 2011

Thanks for the catch! And sorry about breaking things.

For this particular problem, you can add data-apply="replace" to the problem's vars div.

But other problems don't have it so easy and I need to address this issue with attribute inheritance. I'll take a look at this, but I probably won't have time to write a fix until tonight. I apologize for the delay.

Contributor

sophiebits commented Jun 1, 2011

It's not clear to me why this breaks; this problem type shouldn't inherit from anything.

Contributor

jochu commented Jun 1, 2011

Oh, I guess you could also remove the empty <div class="vars"> at the top.

The global definition of vars is:

<div class="vars">
</div>

The problem then has:

<div class="vars" data-ensure="B <= 60">
  <var id="A">randRange(3, 20)</var>
  <var id="B">randRange(7, 24) * (A - 1)</var>
</div>

The default inheritance behavior for vars is to append the contents of the div only. The attribute (data-ensure) is not kept.

Contributor

jochu commented Jun 1, 2011

Removing the global definition allows vars to be defined on its own within the problem. Also, telling it to data-apply="replace" will replace the entire element, thus keeping the data-ensure attribute.

Contributor

sophiebits commented Jun 2, 2011

Closed by d2c0df6.

@sophiebits sophiebits closed this Jun 2, 2011

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