Hi,

I've recently developed my first question type, **calculated objects** which extends the built-in *calculated* question type.

Teachers can use it to create questions like ‘`How much is {apples} + {oranges}?`

’

-- where the {wildcards} become M and N x images of apples and oranges respectively (also {pineapples} {pears}...). Its aimed at primary-school pupils (age 4+).

I've submitted it to Moodle Contrib and I thought I'd mention it here in case it sounds useful.

tracker.moodle.org/browse/CONTRIB-2308 - 1st version of code and details here.

Feedback welcome

Nick

Hi Nick

Very nice work.

The only trouble is the lack of meaning; one cannot subtract or divide different objects.

3 apples + 2 apples would make absolutely sense though.

'6 apples' divided by '2' is '3 apples'. This is probably what you want.

'6 apples' divided by '2 apples' is '4 apples'.

Best regards

Morten

I've always been poor at maths. I understand a and b allright. But I have no idea what is meant by c. '6 apples' divided by '2 apples' is '4 apples'.a. 3 apples + 2 apples would make absolutely sense though.

b. '6 apples' divided by '2' is '3 apples'. This is probably what you want.

c. '6 apples' divided by '2 apples' is '4 apples'.

Joseph,

I also feel a bit ashamed of myself by shooting at Nicks fine question type, but...

xxxxxx/xx = xxxx , by reduction.

Best regards

Morten

What do we do with "apples squared" , not to mention to the power of six!

Jeff,

Pierre has allready given the correct and clarified way to use this question type (below).

I was referring to the confusion that these pictures might rise.

Six apples on a row divided with two pineapples on a row. What does it mean?

Six apples on a row divided with two apples on a row. What does it mean? Are the apples summed or multiplied in the rows?

Best regards

Morten

However, I would agree that the best way to phrase these questions would be:

- I have 4 apples and 3 oranges, how many pieces of fruit do I have?
- I have 7 oranges, and I give away 3 oranges, how many oranges do I have left?
- I have 6 oranges, and I share them out between 3 people, how many oranges does each person get?

6 apple + 2 apple = (6+2) apple = 8 apple

6 apple - 2 apple = (6-2) apple = 4 apple

6 apple * 2 = (6*2) apple = 12 apple

6 apple / 2 = (6/2) apple = 3 apple

The middle column is the abstraction to calculate the number only and the students should learn it. Otherwise, the concept of students will be polluted and a long time to recover from it. Say, if you told them 6 apple/2 apple is 4 apple, they may build up some idea like apple

^{6}/apple

^{2 }= apple

^{4}, which is correct if the notation is something to the power something but it is not what you want.

For the division, you may simply arrange it in the n x m matrix of the apple so that they can see the answer should be side of the matrix.

Thanks for your feedback, much appreciated.

I agree that 3 apples + 2 apples would make more sense (unless you use Tim's phrasing). I'd already thought a little about this.

The problem in terms of the calculation, is that we need to differentiate between the apples. So, which do people prefer in the editor?

- {apples-1} + {apples-2} + {apples-3}
- {apples-A} + {apples-B} + ...
- Something else?

Cheers,

Nick

Hi all,

I'm happy to say that the question type is now in the Modules & Plugins database. And I've addressed various issues:

- The plug-in is now more self-contained and easier to install - details.
- Support for 'like' objects - "
`{apples_1} - {apples_2}`

" as in the screen shot. - Support for arbitrary single-character wildcards. Eg. "{pears} / {x}"
- Support for more textual questions - if the operator or sign doesn't appear in the question text, put it in square brackets, between the wildcards. Eg. "I have {apples_1}, and give away
**[-]**{apples_2}. How...?" - Improved layout.

Enjoy! Yours,

Nick

Hi Nick

thank you for your contribution to Moodle

i tried to understand your creation but i don't understand how it is different to a standard moodle "calculated question" type.

e.g. in moodle you can do the same thing: create two variabes; {apples1} and {apples2}

and then create a question like: John as {apples1} apples, and he eats {apples2} apples. How many does he have left?

i don't understand what your plug in does per se that isn't already being done?

chrs

BK

Very interesting new question type .

I installed it and it worked perfectly

As you can give to your images any values, this could lead to other applications for example in geometry or simulate counting with the small cubes(1 unit), bar(10 units), square(100 units) and big cube (1000 units) as used in elementary schools.

Thanks again.

Pierre

Great. I like your idea about small cubes, bars and so on. Alas, I haven't yet found the full set of shapes - just odd ones, like

en.wikipedia.org/wiki/File:Golden_Cube.svg

flickr.com/search/?q=cube... - Open content searches.

If anyone is good at creating 3-D graphics as flat images, feel free to chip in!

Yours,

Nick

If you have two kind of apples you could build questions with * or / .

You should look at school materials stores like cameleon.com and perhaps could get authorization to use their images.

You should design an easy way to add new items see the proposal of Calculated extended plug-in of Dmitry Pupinin .

Pierre

Here an example.http://www.cameleon.com/fr/catalogue.php?cat=86&page=49

I have installed per directions as a question/type on root and server.

I did figure out the {apples} + {apples} aspect and got the pages to move forward to enter in other figures. This screenshot however is my result. Is there something else that I need to configure?

Below is an excerpt from your README.txt .. These are things I have not done - as it states if I want to Upgrade. Is this the problem with my install that I need to upgrade to 2.0 and make the below changes?

=====

Upgrade.

To upgrade from previous versions:

1. Delete the 'question/type/calculatedobjects' directory.

2. Delete '{MOODLE}/lang/en_utf8/help/quiz/calculatedobjects.html

3. Follow the install instructions above.

TODO/ limitations:

* Add support for multiple operators (currently only 1 supported).

* Test with browsers.

* Test with Moodle 2 beta.

* More testing of backup and restore.

* Evaluate ereg and preg* calls.

* Work on validation functions (qtype_calculatedobjects_find_formula_errors).

* Tidy up.

* If there's demand, add ability to use custom icons/images.

* If there's demand, translation.

Acknowledgements - see file, pix/acknowledgements.txt

=====

Thank you for taking the time to review this request for help and assistance on what I have done improperly in installing your new application.

Best,

Jennie

Sorry, I've only just read your post.

Thanks for trying the Calculated Objects question type and posting your experiences.

First, the reference to "Upgrade" in the readme only referred to upgrading from the pre-release version of the question type to the latest version - nothing to do with Moodle 2.0.

I've created a bug, CONTRIB-2367 for your problem. I haven't worked it out yet - it seems like something (a Moodle filter perhaps?) is post-processing the output from the question type, and replacing new-lines in the HTML source with the <BR> HTML line-break tag.

Please can you send me a HTML save of the page at Site Admin.-Modules-Filters-Manage Filters for your Moodle install?

I'm afraid I'm busy at present, but I hope to look at this urgently middle of next week. I hope this helps.

Many thanks,

Nick

I installed new 2.2.3+ Moodle on brand new site and this question doesnt work with new version of Moodle.

Can you upgrade this plugin for 2.2.3?

Thanks in advance

Hi Ivan,

Thanks for your post.

I've done some investigation, and it seems that the question engine changed a lot between Moodle 2.0.x and 2.1.x. I'll start figuring out how to make the Calculated Objects plugin work with Moodle 2.1.x onwards. Please be patient, as I have various plugins which need maintenance.

I'll post here as I make progress. Best wishes,

Nick

(FYI, this plugin was initially written for the book, Moodle 2 for Teaching 4-9 Year Olds.)

Hi Ivan and everyone,

Thank you for your patience!

I've taken advantage of the long weekend here in the UK, and re-written the Calculated Objects question type for Moodle 2.1 onwards.

- Here is the latest Zip download: 2.1.x-1.0-beta,
- And you can view the code here,
- I'll update the Moodle plugin entry later today.

I look forward to your feedback. Best wishes,

Nick

Hi,

I've fixed another bug CONTRIB-3692 that appeared in the admin interface on first install "Fatal error: Class 'qtype_renderer' not found".

Download the latest Zip - 2.1.x/2.2.x (2.3.x) branch.

I'll package a new release in the next day or two (yes I will!) Best wishes,

Nick

Hello

Moodle 2.2.5+ (Build: 20120927)

downloaded- https://github.com/nfreear/moodle-qtype_calculatedobjects/zipball/MOODLE_21_STABLE

in preview mode, can't see the images.

thank you

Hello James,

Activate Debugging and most probably an error message will be displayed.

Message to Tim : maybe you could change the text diplayed in from of the forum to tell all people in **big red letters**

- to say what Moodle version they are using (it's already here, but not emphasized enough IMHO)
- to activate debugging when something in not working and to post the exact error message

Hello and thank you for replay,

adding this parameter to the question:

Question text: *How much is {apples} + {oranges}*

Correct answer formula= {apples} + {oranges}

debug -

**Fatal error**: Call to undefined method qtype_calculated_variable_substituter::get_maths_operators() in **public_html/moodle/question/type/calculatedobjects/renderer.php** on line **42**

**Thank you**