def assignToSprint(self, inSprint): sprint = None if messagebox.askyesno( 'Assign To Sprint', 'Do you wish to assign item to sprint %s?' % inSprint): for i in self.controller.activeProject.listOfAssignedSprints: if i.sprintName == inSprint: sprint = i if sprint is not None: try: title = self.selectedItem.itemTitle for j in self.controller.dataBlock.items: if j.itemTitle == title: item = j assert item is not None self.controller.dataBlock.assignItemToSprint(item, sprint) comment = ScrumblesObjects.Comment() comment.commentContent = '%s Has Assigned Item %s to Sprint' % ( self.controller.activeUser.userName, item.itemTitle) comment.commentItemID = item.itemID comment.commentUserID = self.controller.activeUser.userID self.controller.dataBlock.addNewScrumblesObject(comment) except Exception as e: messagebox.showerror('Error', str(e)) logging.exception('Error assigning item %s to sprint' % item.itemTitle) return messagebox.showinfo( 'Success', 'Item Assigned Item to sprint, %s' % sprint.sprintName) else: messagebox.showerror('Error', 'Sprint not found in DataBlock') logging.error('Sprint not found in dataBlock')
def ok(self): item = ScrumblesObjects.Item oldItem = self.item item.itemID = oldItem.itemID item.itemTitle = self.itemTitleEntry.get() if item.itemTitle != oldItem.itemTitle: self.validateName(item.itemTitle) item.itemDescription = self.itemDescriptionEntry.get('1.0', 'end-1c') item.itemType = self.ItemTypebox.get() item.itemUserID = self.getSelectedUserID() sprintID, sprintDueDate = self.getSelectedSprintParams() item.itemSprintID = sprintID item.itemDueDate = sprintDueDate item.itemPriority = item.priorityTextToNumberMap[ self.itemPriorityCombobox.get()] item.itemCodeLink = self.itemCodeLinkEntry.get() item.itemStatus = self.discoverStatus(item) item.itemPoints = oldItem.itemPoints comment = ScrumblesObjects.Comment() comment.commentContent = self.commentTextBox.get('1.0', 'end-1c') comment.commentUserID = self.master.activeUser.userID comment.commentItemID = item.itemID if len(comment.commentContent) <= 0: raise Exception( 'Comment box cannot be blank\nPlease enter a change reason.') try: self.dataBlock.updateScrumblesObject(item, oldItem, comment) except IntegrityError: comment.commentID = ScrumblesObjects.generateRowID() self.dataBlock.updateScrumblesObject(item, oldItem, comment) messagebox.showinfo('Info', "Item '%s' Successfully Updated" % item.itemTitle) self.exit()
def assignItemToActiveUser(self): Item = self.backlogPopMenu.getSelectedObject() if Item.itemUserID is not None: messagebox.showerror( 'Error', 'Cannot Assign Item to Self!\nItem already assigned to another user' ) return False Comment = ScrumblesObjects.Comment() Comment.commentItemID = Item.itemID Comment.commentUserID = self.controller.activeUser.userID Comment.commentContent = 'Assigned to self by menu action' self.assignedItems.append(Item) self.userItemList.addItem(Item.itemTitle) self.updateProgressBar() result = messagebox.askyesno( 'Assign To Me', 'Do you want Assign this Item to yourself?') if result: try: self.controller.dataBlock.assignUserToItem( self.controller.activeUser, Item) self.controller.dataBlock.addNewScrumblesObject(Comment) messagebox.showinfo( 'Success', 'Item Assigned to %s' % self.controller.activeUser.userName) except Exception as e: logging.exception('Error Assigning Item to active User') messagebox.showerror('Error', str(e)) return True
def promoteItemToEpic(self, item): logging.info('Promoting Item %s to Epic' % item.itemTitle) oldItem = item comment = ScrumblesObjects.Comment() comment.commentContent = 'promoted item to epic' comment.commentItemID = item.itemID comment.commentUserID = 0 item.itemType = 'Epic' self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment))
def modifyItemStatusByString(self, item, status): logging.info('Modifying item %s to status %s.' % (item.itemTitle, status)) oldItem = item item.itemStatus = item.statusTextToNumberMap[status] comment = ScrumblesObjects.Comment() comment.commentContent = 'Modify Item Status' comment.commentItemID = item.itemID comment.commentUserID = 0 self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment))
def modifiyItemPriority(self, item, priority): logging.info('Modifying item %s priority to %s' % (item.itemTitle, item.priorityNumberToTextMap[priority])) assert priority in range(0, 3) oldItem = item item.itemPriority = priority comment = ScrumblesObjects.Comment() comment.commentContent = 'item priority changed' comment.commentItemID = item.itemID comment.commentUserID = 0 self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment))
def assignItemToSprint(self, item, sprint): logging.info('Assigning Item %s to Sprint %s.' % (item.itemTitle, sprint.sprintName)) oldItem = item item.itemSprintID = sprint.sprintID item.itemDueDate = sprint.sprintDueDate comment = ScrumblesObjects.Comment() comment.commentContent = 'item assigned to sprint' comment.commentItemID = item.itemID comment.commentUserID = 0 self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment))
def removeItemFromSprint(self, item): logging.info('Removing Item %s from sprint %s.' % (item.itemTitle, str(item.itemSprintID))) oldItem = item item.itemSprintID = 0 comment = ScrumblesObjects.Comment() comment.commentContent = 'item removed from sprint' comment.commentItemID = item.itemID comment.commentUserID = 0 self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment))
def ok(self): self.executeSuccess = True oldItem = self.Item comment = ScrumblesObjects.Comment() comment.commentContent = 'modify code link' comment.commentItemID = self.Item.itemID comment.commentUserID = 0 self.Item.itemCodeLink = self.codeLinkEntry.get() if not self.isTest: self.dataBlock.updateScrumblesObject(self.Item, oldItem, comment) self.exit()
def modifyItemStatus(self, item, status): logging.info('Modifying item %s status to %s' % (item.itemTitle, item.statusNumberToTextMap[status])) assert status in range(0, 5) oldItem = item item.itemStatus = item.statusNumberToTextMap[status] comment = ScrumblesObjects.Comment() comment.commentContent = 'modify item status' comment.commentItemID = item.itemID comment.commentUserID = 0 try: self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment)) except Exception as e: item.itemStatus = oldItem.itemStaus raise e
def submitComment(self, event=None): newComment = ScrumblesObjects.Comment() newComment.commentContent = self.newCommentField.get("1.0", tk.END) newComment.commentContent = str(newComment.commentContent) newComment.commentContent = newComment.commentContent.strip() newComment.commentTimeStamp = datetime.datetime.now() newComment.commentSignature = self.master.activeUser.userName + " " + datetime.datetime.now( ).strftime("%I:%M %p, %m/%d/%y") newComment.commentUserID = self.master.activeUser.userID newComment.commentItemID = self.inspection.itemID self.newCommentField.delete("1.0", tk.END) if newComment.commentContent: #check for empty string self.comments.append(newComment) self.renderCommentField(initializedComments=True) self.master.dataBlock.addNewScrumblesObject(newComment)
def assignUserToItem(self, user, item): oldItem = item if user is not None: logging.info('Assigning User %s to item %s.' % (user.userName, item.itemTitle)) item.itemUserID = user.userID item.itemStatus = item.statusTextToNumberMap['Assigned'] else: logging.info('Assinging None User to item %s.' % item.itemTitle) item.itemUserID = None item.itemStatus = item.statusTextToNumberMap['Not Assigned'] comment = ScrumblesObjects.Comment() comment.commentContent = 'Assign user to item' comment.commentItemID = item.itemID comment.commentUserID = 0 self.conn.setMulti(CardQuery.updateCard(item, oldItem, comment))
def removeFromEpic(self): item = None try: title = self.selectedItem.itemTitle for i in self.controller.dataBlock.items: if i.itemTitle == title: item = i self.controller.dataBlock.removeItemFromEpic(item) comment = ScrumblesObjects.Comment() comment.commentContent = '%s Has Removed Item from epic' % self.controller.activeUser.userName comment.commentItemID = item.itemID comment.commentUserID = self.controller.activeUser.userID self.controller.dataBlock.addNewScrumblesObject(comment) except Exception as e: logging.exception('Could not remove item from epic') messagebox.showerror('Error', str(e)) messagebox.showinfo('Success', 'Item Removed')
def ok(self): if self.item is None: item = ScrumblesObjects.Item() else: item = self.item item.itemTitle = self.itemTitleEntry.get() item.itemDescription = self.itemDescriptionEntry.get('1.0', 'end-1c') item.itemType = self.ItemTypebox.get() item.itemPoints = self.pointsEntry.get() item.itemPriority = item.priorityTextToNumberMap[ self.itemPriorityCombobox.get()] self.validateName(item.itemTitle) comment = ScrumblesObjects.Comment() comment.commentContent = self.commentTextBox.get('1.0', 'end-1c') if not self.isTest: comment.commentUserID = self.parent.activeUser.userID comment.commentItemID = item.itemID if not self.isTest: self.writeData(item, comment) self.exit()
def assignToEpic(self, inEpic): epic = None if messagebox.askyesno( 'Assign To Epic', 'Do you wish to assign item to Epic %s?' % inEpic): for i in self.controller.activeProject.listOfAssignedItems: if i.itemType == 'Epic': if i.itemTitle == inEpic: epic = i if epic is not None: try: title = self.selectedItem.itemTitle for j in self.controller.dataBlock.items: if j.itemTitle == title: item = j assert item is not None self.controller.dataBlock.addItemToEpic(item, epic) comment = ScrumblesObjects.Comment() comment.commentContent = '%s Has Assigned Item %s to Epic' % ( self.controller.activeUser.userName, item.itemTitle) comment.commentItemID = item.itemID comment.commentUserID = self.controller.activeUser.userID self.controller.dataBlock.addNewScrumblesObject(comment) except Exception as e: messagebox.showerror('Error', str(e)) logging.exception('Error assigning item %s to epic' % item.itemTitle) return messagebox.showinfo( 'Success', 'Item Assigned Item to Epic, %s' % epic.itemTitle) else: messagebox.showerror('Error', 'Epic not found in DataBlock') logging.error('Epic not found in dataBlock')
assert item.itemDueDate == element['CardDueDate'] assert item.itemCodeLink == element['CardCodeLink'] assert item.itemSprintID == element['SprintID'] assert item.itemUserID == element['UserID'] assert item.itemStatus == element['Status'] listOfItems.append(item) assert len(listOfItems) == len(allItemsQueryResult) for element in allCommentsQueryResult: assert len(element) == 5 assert 'CommentID' in element assert 'CommentTimeStamp' in element assert 'CommentContent' in element assert 'CardID' in element assert 'UserID' in element comment = ScrumblesObjects.Comment(element) assert comment.commentID == element['CommentID'] assert comment.commentTimeStamp == element['CommentTimeStamp'] assert comment.commentContent == element['CommentContent'] assert comment.commentItemID == element['CardID'] assert comment.commentUserID == element['UserID'] listOfComments.append(comment) assert len(listOfComments) == len(allCommentsQueryResult) print('Scrumbles Objects created successfully') ## Test Authentication Query dataConnection.connect() authUserQuery = ScrumblesData.Query.getUserByUsernameAndPassword(ScrumblesUser_username, ScrumblesUser_password) authUserQueryResult = dataConnection.getData(authUserQuery) dataConnection.close()
def updateAllObjects(self): if self.firstLoad: time.sleep(1) self.isLoading = True funcStartTime = time.clock() self.conn.connect() self.users.clear() self.items.clear() self.projects.clear() self.comments.clear() self.tags.clear() self.sprints.clear() self.itemMap = {} self.sprintMap = {} self.commentMap = {} self.projectMap = {} self.userMap = {} #print('getting tables') loopStartTime = time.clock() userTable = self.conn.getData(Query.getAllUsers) itemTable = self.conn.getData(Query.getAllCards) projectTable = self.conn.getData(Query.getAllProjects) commentTable = self.conn.getData(Query.getAllComments) sprintTable = self.conn.getData(Query.getAllSprints) userToProjectRelationTable = self.conn.getData(Query.getAllUserProject) itemToProjectRelationTable = self.conn.getData(Query.getAllProjectItem) itemTimeLineTable = self.conn.getData('SELECT * FROM CardTimeLine') epicTable = self.conn.getData('SELECT * FROM EpicTable') self.conn.close() #print('Tables loaded in %fms' % ((time.clock()-loopStartTime)*1000) ) loopStartTime = time.clock() #print('splicing vectors') timeLineMap = self.mapTimeline(itemTimeLineTable) epicMap = self.buildEpicMap(epicTable) for comment in commentTable: Comment = ScrumblesObjects.Comment(comment) self.comments.append(Comment) self.commentMap[Comment.commentID] = Comment #print('Comment List Built in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for item in itemTable: Item = ScrumblesObjects.Item(item) Item.listOfComments = [ C for C in self.comments if C.commentItemID == Item.itemID ] self.applyItemLine(Item, timeLineMap) # try: # Item.itemTimeLine = timeLineMap[Item.itemID] # except KeyError: # timeLineMap = self.reloadTimeLineMap() if 'AssignedToSPrint' in Item.itemTimeLine: Item.itemTimeLine['AssignedToSprint'] = Item.itemTimeLine[ 'AssignedToSPrint'] #self.populateItemTimeLine(Item,timeLineMap) self.itemMap[Item.itemID] = Item self.items.append(Item) #print('Item List Built in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for I in self.items: if I.itemID in epicMap: #epicMap[subitemID]->EpicID self.itemMap[epicMap[I.itemID]].subItemList.append( I) #itemMap[itemID]->Item #print('Item subitems spliced in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for user in userTable: User = ScrumblesObjects.User(user) User.listOfAssignedItems = [ I for I in self.items if I.itemUserID == User.userID ] User.listOfComments = [ C for C in self.comments if C.commentUserID == User.userID ] self.users.append(User) self.userMap[User.userID] = User #print('User List Built in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for sprint in sprintTable: Sprint = ScrumblesObjects.Sprint(sprint) Sprint.listOfAssignedItems = [ I for I in self.items if I.itemSprintID == Sprint.sprintID ] Sprint.listOfAssignedUsers = [ U for U in self.users if U.userID in [I.itemUserID for I in Sprint.listOfAssignedItems] ] self.sprints.append(Sprint) self.sprintMap[Sprint.sprintID] = Sprint #print('Sprint List Built in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for project in projectTable: Project = ScrumblesObjects.Project(project) Project.listOfAssignedSprints = [ S for S in self.sprints if S.projectID == Project.projectID ] self.projects.append(Project) self.projectMap[Project.projectID] = Project #print('Project List Built in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for user in self.users: for dict in userToProjectRelationTable: if dict['UserID'] == user.userID: for project in self.projects: if dict['ProjectID'] == project.projectID: user.listOfProjects.append(project) #print('Users Spliced to Projects in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for project in self.projects: for dict in userToProjectRelationTable: if dict['ProjectID'] == project.projectID: for user in self.users: if dict['UserID'] == user.userID: project.listOfAssignedUsers.append(user) #print('Projects spliced to users in %fms' % ((time.clock() - loopStartTime) * 1000)) loopStartTime = time.clock() for dict in itemToProjectRelationTable: if dict['ProjectID'] == project.projectID: for item in self.items: if dict['ItemID'] == item.itemID: item.projectID = project.projectID project.listOfAssignedItems.append(item) #print('Items Spliced to Projects in %fms' % ((time.clock() - loopStartTime) * 1000)) #self.debugDump() #print('Data Loaded in %fs' % (time.clock()-funcStartTime)) self.isLoading = False return True