WeBWorK Main Forum

"show past answers" includes answers from last semester?

"show past answers" includes answers from last semester?

by Andras Balogh -
Number of replies: 10
I reuse my courses by deleting last semester's students from the classlist and then adding new ones to it.
I am surprised to see that for a student who is repeating the course with me, and who was deleted and added to the classlist, the "Show Past Answer" button shows not just this semester's answers, but last semester's answers as well:

User: XYZ Set: 7_8 Problem: 8
22 Sep 2009
15:15:20 0 No
12 Feb 2010
14:08:46 5 yes
14:10:09 4 yes

So apparently this warning is not true?
"Deletion destroys all user-related data and is not undoable!"

Am I going to have problems with all the old answers and data accumulating somewhere?


Andras
In reply to Andras Balogh

Re: "show past answers" includes answers from last semester?

by William Wheeler -
Dear Andras,

On my system, the explanation would be as follows (but the organization of your system may be different from mine).

The "Past Answers" are not stored in the database, which is where the deletions occur (and the deletions are irreversible with respect to the database by itself).

Rather, the past answers are stored in the course log files.

If you are reusing a course by only deleting the students from the database without purging the log files, then the old log files will still be searched when you "Show Past Answers". You need to locate the old "answer_log" (look in the course's log directory) and delete, rename, or move it.
In reply to William Wheeler

Re: "show past answers" includes answers from last semester?

by Andras Balogh -
Thanks William,

I found the answer_log file along with files login.log and transaction.log.

They contain information going back to 2006.

So my next question is whether there is a simple way to clean ALL these files for ALL existing courses (maybe at the beginning of next semester) or if I should write my own script for that.
In reply to Andras Balogh

Re: "show past answers" includes answers from last semester?

by William Boshuck -
Typing the following line at a shell prompt should
do it (assuming a Bourne compatible shell and
suitable write permissions)

for log in COURSES/*/logs/*log; do cat /dev/null >| $log; done

where COURSES contains the course directories
on your server.

-wb
In reply to William Boshuck

Re: "show past answers" includes answers from last semester?

by Andras Balogh -
Thanks William

I tried this for two courses not currently in use.
It clearly empties the log files, but now answers to new assignments are not logged.

The login.log file is filling up with lines, but both the answer_log and the transaction.log files stay empty.

Andras
In reply to Andras Balogh

Re: "show past answers" includes answers from last semester?

by Michael Gage -
Andras,

Try creating a fake student in the course and using that to check the transaction and answer_logs. As I recall we didn't record answers in the answer_log when the actual user was an instructor so as to keep the answer_log "pure" when an instructor acted as a particular student. See if an actual student's answers are recorded in the answer_log file.

I'm not sure this explains the transaction log however.

Hope this helps.

-- Mike
In reply to Michael Gage

Re: "show past answers" includes answers from last semester?

by William Boshuck -
One possibility is that the transaction.log
file currently being used is somewhere else.
On our installation (2.4.7) the transaction.log
files being written to are under webwork2/logs/
somewhere and not under the courses' logs
directories.

stat -x `locate transaction.log | grep "/CourseName/"`

(just stat if you're running Linux, I think)

should show you the various versions and when
they were last modified, assuming the locate
database is sufficiently current.
(/usr/libexec/locate.updatedb should update it
on *BSD, and /usr/bin/updatedb should update
it on Linux, if that needs to be done).

cheers,
-wb
In reply to William Boshuck

Re: "show past answers" includes answers from last semester?

by Andras Balogh -
Thanks to everybody for the help.

Yes, only students' answers are logged,
and yes, the transactions are logged in a different directory now.

So now I wonder if the transaction log files should be cleaned or not every once in a while.
The biggest one is 30Mb, and there is a timing.log file with size 334Mb.

Andras
In reply to Andras Balogh

Re: "show past answers" includes answers from last semester?

by Malcolm Harper -
If logrotate is installed on your system then it can be configured to keep timing.log from growing too large. We have the following file in /etc/logrotate.d/
# /etc/logrotate.d/webwork
# M. Harper 2010-01-30
# Rotate webwork log files
# only timing.log for now
# mail to gmail account for now
/opt/webwork/webwork2/logs/timing.log {
weekly
rotate 5
compress
delaycompress
missingok
notifempty
create
dateext
mail somebody@somewhere.com
}
This keeps five weekly compressed logs and mails the oldest before deleting it. Of course you will have to modify the path to match your installation. If you want to accumulate a log archive then modify the email address, if not then the mail line can be deleted.

We don't worry about the course transaction logs until the end of the term when they can be cleared out.

Malcolm
In reply to Malcolm Harper

Re: "show past answers" includes answers from last semester?

by Andras Balogh -
Thanks Malcolm,

I will try archiving the files before the next semester.

Andras
In reply to Andras Balogh

Re: "show past answers" includes answers from last semester?

by William Boshuck -
I think this has to do with professor's answers
not being recorded in answer_log (as Michael
suggested).

I just tried this out on my test course, and
the test student's answers were recorded
after answer_log was truncated in the way
I mentioned. Things might work differently
on your installation. Off-hand I can't see
why, so I'd be interested to know they do.

cheers,
-wb