Project

General

Profile

Bug #5783

The deleted assignments are counted in the total number of documents

Added by Hubert Borderiou almost 9 years ago. Updated almost 9 years ago.

Status:
Bug resolved
Priority:
Low
Assignee:
Yoselyn Castillo
Category:
Assignments / Work
Target version:
Start date:
28/11/2012
Due date:
% Done:

90%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

Hi,
in the assignments tool you see the number of assignments under the name of the category.
Works from deleted users are still counted.

May be we shouldn't count these work for the moment.
(related too http://support.chamilo.org/issues/5611)


Files

assignments.gif (24 KB) assignments.gif Yoselyn Castillo, 17/12/2012 17:12
work.lib.php (84.8 KB) work.lib.php Yoselyn Castillo, 17/12/2012 19:40

Related issues

Related to Chamilo LMS - Bug #5611: Various problem concerning Course Tools when deleting user from PlatformNew05/10/2012

Actions
Related to Chamilo LMS - Feature #5842: Upgrade: Clean tasks from users who have been deletedNew24/12/2012

Actions

Associated revisions

Revision 61fd75a1 (diff)
Added by Yannick Warnier almost 9 years ago

Sent fixes for the documents counting in assignments. Now DELETING users assignments when the users are deleted - refs #5783

History

#1

Updated by Julio Montoya almost 9 years ago

  • Status changed from New to Needs more info

This could be already fixed due the changes you made in the work visibility?

#2

Updated by Yoselyn Castillo almost 9 years ago

  • Status changed from Needs more info to Assigned

testing...

#3

Updated by Yoselyn Castillo almost 9 years ago

  • Assignee set to Yoselyn Castillo
#4

Updated by Yoselyn Castillo almost 9 years ago

In stable.chamilo.org I have crated an assignment in a course with 2 users.
I have uploaded 3 files for the assignment as both users.
I have entered the assignment tool
It shows 3 files
I have deleted 1 user
I have entered the assignment tool
It continues showing 3 files, including the file uploaded by the deleted user.
See the attachment
Fixing

#5

Updated by Yoselyn Castillo almost 9 years ago

Fixed problem for documents uploaded from deleted users, but I want to know if makes sense documents are still saved when users have been deleted.
Upload this

#6

Updated by Yannick Warnier almost 9 years ago

  • Assignee changed from Julio Montoya to Yoselyn Castillo
  • % Done changed from 0 to 50

Assignments (documents) should be deleted if the users have been deleted.
main/inc/lib/usermanager.lib.php::delete_user() is supposed to take that in charge (although the documentation for the function should really say so in the first place :-p). Please check there to see if tasks are deleted.

If an admin doesn't want the user items to be deleted, he will simply "disable" the user, not delete it.

#7

Updated by Hubert Borderiou almost 9 years ago

  • Priority changed from Normal to Low

I think it is never harmless to delete automatically datas from a course.
Could we put this ticket in a more general reflection about data life cycle (http://support.chamilo.org/issues/5611 ) ?
For exemple, in the forum tool, when a user is deleted, its messages are not deleted, but his name is replaced by "Anonymous".

Should we keep forum entries and not assignements files when deleting a user ?
I don't know.
Teachers are used to keep previous forums, for exemple. Many of them change the name of there courses (eg. MyCourse2011 to keep previous datas, even if students are deleted from the plarform. It is important for them to have previous courses alive, and it is a real advantage and a good point for the platform (I'll check the behavirou of other platform concerning this important suvject).
I should be a problem for us to keep every users disabled, because, we have 10000 new users each years, and the user list will be a bit too long.

Moreover, when a teacher delete a course, he knows what he is doing (most of the time ;-) ), I'm not very found of deleting automatically users datas. I guess a teacher who want to empty his course, should use the Recycle-course tool.

This ticket is not urgent for me, even if it is a really interesting subject, I'd rather be able to talk about data life cycle before, if you are agree.

What do you think ?

#8

Updated by Yoselyn Castillo almost 9 years ago

  • Assignee changed from Yoselyn Castillo to Julio Montoya

Well, i have been reviewing the documentation and code for usermanager.lib.php::delete_user() and i have not found tasks are deleted when user have been deleted. So i think we can apply the previous patch for verifying if user exists in database. what do you think??

#9

Updated by Yannick Warnier almost 9 years ago

  • Subject changed from In assignments folder are counted works of deleted users to The deleted assignments are counted in the total number of documents
#10

Updated by Yannick Warnier almost 9 years ago

  • Assignee changed from Julio Montoya to Yannick Warnier

Yoselyn Castillo wrote:

Well, i have been reviewing the documentation and code for usermanager.lib.php::delete_user() and i have not found tasks are deleted when user have been deleted. So i think we can apply the previous patch for verifying if user exists in database. what do you think??

The right way to do it is to:
  • add the code to the delete_user() function to delete the assignments (files and database records)
  • in the query you modified, user INNER JOIN with the user table to guarantee there is a relationship between the two tables. The current form you used works but it could generate problems when we start using other database engines (later on)

Initial version

$sql_document = "SELECT count(*) FROM $work_table WHERE c_id = $course_id AND parent_id = ".$work_data['id']." AND active IN (0, 1) ";

Yoselyn's version

$sql_document = "SELECT count(*) FROM $work_table w, $user_table u WHERE w.c_id = $course_id AND w.parent_id = ".$work_data['id']." AND w.active IN (0, 1) AND w.user_id = u.user_id ";

INNER JOIN version (which is just a re-formulation of the previous)

$sql_document = "SELECT count(*) FROM $work_table w INNER JOIN $user_table u ON w.user_id = u.user_id WHERE w.c_id = $course_id AND w.parent_id = ".$work_data['id']." AND w.active IN (0, 1)";

#11

Updated by Yannick Warnier almost 9 years ago

The $sql_document query would be left there only because there might remain som stuff from work from users who have been deleted in previous versions, so a cleaning script should be added to the migration of 1.9 to 1.10 and then this query could be left as before (which would be much more efficient on systems with tens of thousands of users). See #5842 for that.

#12

Updated by Yannick Warnier almost 9 years ago

  • Category set to Assignments / Work
  • Status changed from Assigned to Needs testing
  • Assignee deleted (Yannick Warnier)
  • % Done changed from 50 to 90

Sent patches. Leaving a few days for comments. Will be closed soon.

#13

Updated by Yannick Warnier almost 9 years ago

  • Status changed from Needs testing to Bug resolved
  • Assignee set to Yoselyn Castillo

Assuming fixed... (leaving at 90% to mark we didn't have a clear approval from an independent party).

Also available in: Atom PDF