Script to convert Journals to Assignments

Re: Script to convert Journals to Assignments

by Marc Grober -
Number of replies: 12
While still in Moodle short pants I start using journals in 1.8 in part because of the title of the activity, as journal betokens more perhaps what one thinks of today as blogging than an online assignment, i.e. something that is immediate, takes place as part of experience if you will, not after, and is on-going. While the functionality does indeed exist elsewhere, the "journal" as a functional centerpiece of reflective practice, will be sorely missed.... perhaps I should replace all instances of "online assignment" with "journal" ;=}

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.....
In reply to Marc Grober

Re: Script to convert Journals to Assignments

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It does work... it's had quite a lot of testing and refinement (I hope).

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).
In reply to Howard Miller

Re: Script to convert Journals to Assignments - Tracker item to include in core 2.0 setup

by Marc Grober -
In reply to Marc Grober

Re: Script to convert Journals to Assignments - Tracker item to include in core 2.0 setup

by rui gomes -
Hello,

We have version 1.9.8 and getting this error:

Error reading journals from database


Anyone help?

Regards,

João Neves
In reply to rui gomes

Re: Script to convert Journals to Assignments - Tracker item to include in core 2.0 setup

by Mario Santonastaso -
Not sure if this is the issue, but I recently had an issue where all forums were showing no posts. In my Moodle installation, under Site Administration, I have a Server>Database link that brings me to MySQL Admin. The the MySQL Admin is available online for Moodle and adds that menu item to Site Administration under Server. Here you can perform repairs on the various database tables that Moodle uses to store its information. If you can't read the Journal posts, you might look here to see if that table needs repair.

In reply to Mario Santonastaso

Re: Script to convert Journals to Assignments - Tracker item to include in core 2.0 setup

by rui gomes -
I have repaired the tables, didnt help.

The error message only appear when we try to run the journal php.
In reply to Marc Grober

Re: Script to convert Journals to Assignments

by Paul Webster -

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

 

Any ideas?

I appreciate your help.

In reply to Paul Webster

Re: Script to convert Journals to Assignments

by Greg Padberg -

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:

https://github.com/jamesballard/moodle-misc_journal2assignment

Can anybody vouch that the convert script works with Moodle 2.2?

In reply to Greg Padberg

Re: Script to convert Journals to Assignments

by Greg Padberg -

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)

 

Error writing to database

More information about this error

Debug info: Column 'grade' cannot be null
INSERT INTO mdl_assignment (course,name,intro,introformat,assignmenttype,resubmit,preventlate,emailteachers,var1,var2,var3,var4,var5,maxbytes,timedue,timeavailable,grade,timemodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
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',
)]
Stack trace:
  • 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?

In reply to Greg Padberg

Re: Script to convert Journals to Assignments

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

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.

HTH,

AL

In reply to AL Rachels

Re: Script to convert Journals to Assignments

by James Ballard -

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

Yours

James

In reply to James Ballard

Re: Script to convert Journals to Assignments

by Greg Padberg -

The journal2assignment.php script worked successfully on my Moodle 2.2.10 installation.

Thanks for your help!

In reply to Greg Padberg

Re: Script to convert Journals to Assignments

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

You're welcome Greg. Also thanks to James for the commit.

AL