<commit_before>/*
 * Copyright 2011 <NAME> <<EMAIL>>, <NAME>
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
 * General Public License as published by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
package scrum.client.project;

import ilarkesto.core.base.Str;
import ilarkesto.core.base.Utl;
import ilarkesto.core.logging.Log;
import ilarkesto.core.scope.Scope;
import ilarkesto.core.time.Date;
import ilarkesto.core.time.DateAndTime;
import ilarkesto.core.time.Time;
import ilarkesto.gwt.client.AGwtEntity;
import ilarkesto.gwt.client.Gwt;
import ilarkesto.gwt.client.HyperlinkWidget;
import ilarkesto.gwt.client.editor.AEditorModel;
import ilarkesto.gwt.client.editor.AFieldModel;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import scrum.client.ScrumGwt;
import scrum.client.admin.Auth;
import scrum.client.admin.ProjectUserConfig;
import scrum.client.admin.User;
import scrum.client.collaboration.Comment;
import scrum.client.collaboration.ForumSupport;
import scrum.client.collaboration.Subject;
import scrum.client.collaboration.Wikipage;
import scrum.client.common.ShowEntityAction;
import scrum.client.common.WeekdaySelector;
import scrum.client.dashboard.DashboardWidget;
import scrum.client.files.File;
import scrum.client.impediments.Impediment;
import scrum.client.issues.Issue;
import scrum.client.journal.ProjectEvent;
import scrum.client.pr.BlogEntry;
import scrum.client.release.Release;
import scrum.client.risks.Risk;
import scrum.client.sprint.Sprint;
import scrum.client.sprint.Task;

import com.google.gwt.user.client.ui.Widget;

public class Project extends GProject implements ForumSupport {

	private static transient final Log LOG = Log.get(Project.class);

	private static final String effortUnit = "pts";
	public static final String INIT_LABEL = "New Project";

	private transient Comparator<Requirement> requirementsOrderComparator;
	private transient Comparator<Issue> issuesOrderComparator;

	public Project(User creator) {
		setLabel(INIT_LABEL + " " + DateAndTime.now());
		addParticipant(creator);
		addAdmin(creator);
		addProductOwner(creator);
		addScrumMaster(creator);
		addTeamMember(creator);
		setLastOpenedDateAndTime(DateAndTime.now());
	}

	public Project(Map data) {
		super(data);
	}

	public boolean isHomepagePublishingEnabled() {
		return !Str.isBlank(getHomepageDir());
	}

	public int getTotalMisconducts() {
		int sum = 0;
		for (ProjectUserConfig config : getProjectUserConfigs()) {
			sum += config.getMisconducts();
		}
		return sum;
	}

	public Requirement getNextProductBacklogRequirement() {
		List<Requirement> requirements = getProductBacklogRequirements();
		if (requirements.isEmpty()) return null;
		Collections.sort(requirements, getRequirementsOrderComparator());
		return requirements.get(0);
	}

	public List<String> getThemes() {
		Set<String> themes = new HashSet<String>();
		for (Requirement requirement : getRequirements()) {
			themes.addAll(requirement.getThemes());
		}
		for (Issue issue : getIssues()) {
			themes.addAll(issue.getThemes());
		}
		List<String> ret = new ArrayList<String>(themes);
		Collections.sort(ret);
		return ret;
	}

	public void updateRequirementsModificationTimes() {
		for (Requirement requirement : getRequirements()) {
			requirement.updateLocalModificationTime();
		}
	}

	@Override
	public boolean isEditable() {
		User currentUser = Scope.get().getComponent(Auth.class).getUser();
		return currentUser.isAdmin() || isAdmin(currentUser);
	}

	public List<Issue> getClaimedBugs(User user) {
		List<Issue> issues = new ArrayList<Issue>();
		for (Issue issue : getBugs()) {
			if (issue.isOwner(user) && !issue.isFixed()) issues.add(issue);
		}<commit_msg>iss709 skip themes from history<commit_after>/*
 * Copyright 2011 <NAME> <<EMAIL>>, <NAME>
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
 * General Public License as published by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
package scrum.client.project;

import ilarkesto.core.base.Str;
import ilarkesto.core.base.Utl;
import ilarkesto.core.logging.Log;
import ilarkesto.core.scope.Scope;
import ilarkesto.core.time.Date;
import ilarkesto.core.time.DateAndTime;
import ilarkesto.core.time.Time;
import ilarkesto.gwt.client.AGwtEntity;
import ilarkesto.gwt.client.Gwt;
import ilarkesto.gwt.client.HyperlinkWidget;
import ilarkesto.gwt.client.editor.AEditorModel;
import ilarkesto.gwt.client.editor.AFieldModel;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import scrum.client.ScrumGwt;
import scrum.client.admin.Auth;
import scrum.client.admin.ProjectUserConfig;
import scrum.client.admin.User;
import scrum.client.collaboration.Comment;
import scrum.client.collaboration.ForumSupport;
import scrum.client.collaboration.Subject;
import scrum.client.collaboration.Wikipage;
import scrum.client.common.ShowEntityAction;
import scrum.client.common.WeekdaySelector;
import scrum.client.dashboard.DashboardWidget;
import scrum.client.files.File;
import scrum.client.impediments.Impediment;
import scrum.client.issues.Issue;
import scrum.client.journal.ProjectEvent;
import scrum.client.pr.BlogEntry;
import scrum.client.release.Release;
import scrum.client.risks.Risk;
import scrum.client.sprint.Sprint;
import scrum.client.sprint.Task;

import com.google.gwt.user.client.ui.Widget;

public class Project extends GProject implements ForumSupport {

	private static transient final Log LOG = Log.get(Project.class);

	private static final String effortUnit = "pts";
	public static final String INIT_LABEL = "New Project";

	private transient Comparator<Requirement> requirementsOrderComparator;
	private transient Comparator<Issue> issuesOrderComparator;

	public Project(User creator) {
		setLabel(INIT_LABEL + " " + DateAndTime.now());
		addParticipant(creator);
		addAdmin(creator);
		addProductOwner(creator);
		addScrumMaster(creator);
		addTeamMember(creator);
		setLastOpenedDateAndTime(DateAndTime.now());
	}

	public Project(Map data) {
		super(data);
	}

	public boolean isHomepagePublishingEnabled() {
		return !Str.isBlank(getHomepageDir());
	}

	public int getTotalMisconducts() {
		int sum = 0;
		for (ProjectUserConfig config : getProjectUserConfigs()) {
			sum += config.getMisconducts();
		}
		return sum;
	}

	public Requirement getNextProductBacklogRequirement() {
		List<Requirement> requirements = getProductBacklogRequirements();
		if (requirements.isEmpty()) return null;
		Collections.sort(requirements, getRequirementsOrderComparator());
		return requirements.get(0);
	}

	public List<String> getThemes() {
		Set<String> themes = new HashSet<String>();
		for (Requirement requirement : getRequirements()) {
			if (requirement.isClosed()) continue;
			themes.addAll(requirement.getThemes());
		}
		for (Issue issue : getIssues()) {
			if (issue.isClosed()) continue;
			themes.addAll(issue.getThemes());
		}
		List<String> ret = new ArrayList<String>(themes);
		Collections.sort(ret);
		return ret;
	}

	public void updateRequirementsModificationTimes() {
		for (Requirement requirement : getRequirements()) {
			requirement.updateLocalModificationTime();
		}
	}

	@Override
	public boolean isEditable() {
		User currentUser = Scope.get().getComponent(Auth.class).getUser();
		return currentUser.isAdmin() || isAdmin(currentUser);
	}

	public List<Issue> getClaimedBugs(User user) {
		List<Issue> issues = new ArrayList<Issue>();
		for (Issue issue : getBugs()) {
			if (issue.isOwner(user) && !issue.isFixed()) issues.add(issue);
		}
{'fraction_non_alphanumeric': 0.10706978858831552, 'fraction_numerical': 0.001932257331211639, 'mean_word_length': 5.325664989216391, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2882927', 'n_tokens_mistral': 2829, 'n_tokens_neox': 2671, 'n_words': 674}