Anonymous avatar Anonymous committed 31c5ceb

these bugs fixed:
1. tasklist owner can't be collaborator
2. collaborators email list not checked correctly
3. collaborator approval done per collaborator email, regardless of task

Comments (0)

Files changed (2)

taskhood/tasks/views.py

         for key in tasklist.tasks:
             tasks.append(db.get(key))
     #check collaboration status
+    list_owner = tasklist.created_by.email();
     for task in tasks:
         if len(tasklist.shared_users_emails) == 0 or len(task.collaborators) == 0:
             task.collaboartion_Status = ""
             task.user_required = "No"
             for collaborator_id in task.collaborators:
                 collaborator = db.get(collaborator_id)
-                if collaborator.email in tasklist.shared_users_emails:
+                if collaborator.email in tasklist.shared_users_emails or collaborator.email == list_owner:
                     task.collaborators_eMails += collaborator.email + ","
                     needed+=1
                     if collaborator.completed:
                 if 'approved' in request.POST:
                     user = users.get_current_user()
                     if user.email() in task.collaborators_eMails.split(","):
-                        coll = collaborator.all().filter('email =', user.email()).fetch(1)[0]
-                        coll.completed = True
-                        coll.put()
+                        for collaborator_id in task.collaborators:
+                            col = db.get(collaborator_id)
+                            if col.email == user.email():                        
+                                col.completed = True
+                                col.put()
                 else:    
                     status = Status.all().filter('type =', request.POST[f]).fetch(1)[0]
                     task.status = status
     if 'collaborators_eMails' in request.POST:
         for email in request.POST['collaborators_eMails'].split(","):
-            if not email in task.collaborators_eMails:
+            found = False
+            for collaborator_id in task.collaborators:
+                col = db.get(collaborator_id)
+                if col.email == email:
+                    found = True
+#            if not email in task.collaborators_eMails:
+            logging.info('found is - ')
+            logging.info(found)
+            if not found and not email == '':
+                logging.info('adding')
+                logging.info(email)
                 c = collaborator(email=email, completed=False)
                 c.put()
                 task.collaborators.append(c.key())
Add a comment to this file

taskhood/tasks/views.pyc

Binary file modified.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.