Get it here...
Instructions are in the comments at the top.
I just tested the script on a fresh install of Moodle 1.9 with a sample course and sample journal.
I graded the journal entry a 42/100, then ran the conversion script. It added an online text assignment with the same name, and the grade and comments were transferred over correctly to the assignment.
When I go into the gradebook, however, the online text assignment is listed but shows no grade entered for the test student. Any ideas why this is happening?
Thanks for your help.
Also, some things to do...
1. The newly created assignment needs to be placed in the teachers page in the exact same location as the pre-existing journal item.
2. Make a flag, default set to false, that will delete the journal after the assignment is created.
The assignment *should* be immediately above the old Journal.
I decided not to delete the Journals so you can check it. You can do that very easily in the Modules screen in the Site Administration.
Your script worked like a charm and I've converted all my Journals to Assignments and hid the Journal activity.
I did notice that on 1.9, it doesn't put the new assignments into a gradebook category and I had to go in manually and match those back up. Not sure what sort of effort that may take, or if you even want to - you'd have to build a check for what Moodle version they're using, wouldn't you?
I'm *really* hazy about the gradebook because we don't use it. I don't really understand. Can you spell out the problem and I'll have a look.
You did use the very latest version? It's up to 1.5 now
Ahhh... it doesn't transfer the "common module settings" at all. There's something else where I'm unsure how it works. Off to trawl through code
Journals don't have grade categories. I'm confused!
Places new grade items in correct category and gives it correct sort order.
Moves old journal grade items to the back and hides them from students.
Skips journal items left over from deleted courses
Debug items added but debug is default turned off.
Would you mind checking out Matthew's latest conversion script? If it looks good can you check it into CVS? Thanks!
Simply stick it in the root of your Moodle installation and run it from a web browser. You need to be logged in as admin first.
There is no Journal code in Moodle 2.0, so the Journal tables will be left completely alone by the upgrade. The script should still function.
You have reminded me to check that the script works at all under 2.0. I think we'll need to do a different version for that anyway.
Yes indeed, the script will (as it stands) not work under Moodle 2.0 so, until I can get it sorted, the advice is to fix Journals before upgrade. I know that won't cut it though
However, to the functional issue!
I am, I guess, surprised that an upgrade from Moodle 1.x to Moodle 2 where the Moodle has courses with journals will run smoothly. I had expected that it would result in making quite a mess of the coursees assignments and gradebook, but assuming that is not the case, it seems to me that it makes sense to ensure that the Moodle 2 setup checks the db to determine if there are journals and then offers the option to convert or cancel, as there are quite a few people who continue to use journals (whether they are romatics like me or just uninformed of the obsolescence) and this could be a worse experience than that of upgrading to 1.9 and discovering that all your gradebooks now resemble badly scrambled eggs while grades are due in 48 hrs......
I guess here again I am trying to look at the situation from the perspective of the gazillion users who are not obsessive about forum postings or implementing the latest stable (there are lots of folks still using Moodle 1.4 because it provides them what they need....) What will Joe User, with a moodle with dozens of existing courses which have contained journals for some years, have to deal with when he decides to go ahead and upgrade to Moodle 2 and then get calls from teachers saying that none of their journals work? If one is going to claim that Moodle is so easy to use that even a "teacher" can manage it, then we had better make sure we trap all issues before they create some meltdown for Joe.....
The name of the Assignment module has been a bugbear for a lot of people, I know. I guess you can always name it something else in the Language pack.
If you think the upgrade should be in core, you should raise a tracker report that can be voted on. It would be easy enough to make part of the upgrade (it was developed from the original 1.5 code after all).
We have version 1.9.8 and getting this error:
Error reading journals from database
The error message only appear when we try to run the journal php.
I recently upgraded from 1.9 to 2.0. I didn't realize journal was not going to be supported anymore. Is it too late to run the journal2assignment script? I put the php file in the root of my moodle and then put it in the address of my browser.
I get an error: get_records() not available anymore
I appreciate your help.
I still have a lot of Journal activities on my server, last year we migrated from Moodle 1.9 and are now at 2.2 with plans to upgrade to 2.4 or possibly newer. I must have elected not to convert the Journal activities to Assignments at some point during previous upgrades. As Moodle 2.5 has now been released and the Journal add-on module is not yet available beyond Moodle 2.4, I am looking towards the future and hope to not leave any Journal data behind.
I found the following:
Can anybody vouch that the convert script works with Moodle 2.2?
I tried the script on my Moodle 2.2.10 installation with the following result (debugging turned on):
Converting Journal 'Are you ergonomically correct??' (433)
INSERT INTO mdl_assignment (course,name,intro,introformat,assignmenttype,resubmit,preventlate,emailteachers,var1,var2,var3,var4,var5,maxbytes,timedue,timeavailable,grade,timemodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
0 => '95',
1 => 'Are you ergonomically correct??',
2 => 'Many people have a hard time working at the computer in an ergonomically correct way. People have a habit of sitting at the ccomputer in a certain way that may not be ergonomically correct. For me, I have a difficult time keeping my feet flat on the floor. In a short paragraph, tell me what are the most difficult things for <em>you</em> to be ergonomically correct and how you are going to try and correct it. Name at least 2 things. In the long run, it will be good for you. This will be counted in your \\"Real life Applicatiom\\" mark. ',
3 => '1',
4 => 'online',
5 => 1,
6 => 0,
7 => 0,
8 => 1,
9 => 0,
10 => 0,
11 => 0,
12 => 0,
13 => 0,
14 => 0,
15 => '1251180000',
16 => NULL,
17 => '1251579874',
- line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
- line 973 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
- line 1015 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
- line 99 of /journal2assignment.php: call to mysqli_native_moodle_database->insert_record()
Any experts here that can help me resolve this?
The error is caused by the line of code $assignment->grade = $journal->assessed; The word "assessed" needs to be changed to "grade" instead. It is in line 97 of journal2assignment.php located at https://github.com/jamesballard/moodle-misc_journal2assignment.
Further discussion about this is at https://moodle.org/mod/forum/discuss.php?d=229770#p999415
I have tested this on Moodle 2.2 and 2.6dev and it works on both. Just be aware that the converted assignments are the old style and you will need to run Assignment upgrade helper to fix them. In Moodle 2.6 the converted journal will not even be visible until you run Assignment upgrade helper.
I have committed this change. I am not specifically working with Moodle at the moment so have not had a chance to test.
Hope this works for you
The journal2assignment.php script worked successfully on my Moodle 2.2.10 installation.
Thanks for your help!
You're welcome Greg. Also thanks to James for the commit.