Пример #1
0
    def update_score_build(self, job, build):

        if self.is_connected() is False:
            return False

        for culprit in self.jenkins.get_culprits(build):
            username = culprit["fullName"]
            user = User.objects(name=username).first()
            if user is None:
                user = User(name=username)
                user.save()
            user_score = user.score
            total_bonus = self.jenkins.get_bonus_per_build(job)
            if total_bonus > 5:
                total_bonus = 5
            points = total_bonus + 1

            if build.is_running():
                return False
            else:
                if build.get_status() == 'FAILURE':
                    user_score += points * -5
                elif build.get_status() == 'SUCCESS':
                    user_score += points

                logging.log(
                    logging.DEBUG,
                    user.name + " " + str(user.score) + " " + str(user_score))
                user.update(set__score=user_score)
                user.reload()

        return True
Пример #2
0
	def update_score_build(self, job, build):

		if self.is_connected() is False:
			return False

		for culprit in self.jenkins.get_culprits(build):
			username = culprit["fullName"]
			user = User.objects(name=username).first()
			if user is None:
				user = User(name=username)
				user.save()
			user_score = user.score
			total_bonus = self.jenkins.get_bonus_per_build(job)
			if total_bonus > 5:
				total_bonus = 5
			points = total_bonus + 1

			if build.is_running():
				return False
			else:
				if build.get_status() == 'FAILURE':
					user_score += points * -5
				elif build.get_status() == 'SUCCESS':
					user_score += points

				logging.log(logging.DEBUG, user.name + " " + str(user.score) + " " + str(user_score))
				user.update(set__score=user_score)
				user.reload()

		return True
Пример #3
0
 def insert_users_from_server(self):
     for user in self.jenkins.get_user_list():
         users = User.objects(name=user["name"])
         if users.count() == 0:
             new_user = User(name=user["name"])
             new_user.save()
Пример #4
0
	def insert_users_from_server(self):
		for user in self.jenkins.get_user_list():
			users = User.objects(name=user["name"])
			if users.count() == 0:
				new_user = User(name=user["name"])
				new_user.save()