<commit_before>#encoding: utf-8
#############################################################################
#
# Estimancy, Open Source project estimation web application
# Copyright (c) 2014 Estimancy (http://www.estimancy.com)
#
#    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.
#
#    ======================================================================
#
# ProjEstimate, Open Source project estimation web application
# Copyright (c) 2013 Spirula (http://www.spirula.fr)
#
#    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 Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################


class ModuleProject < ActiveRecord::Base
  attr_accessible  :project_id, :pemodule_id, :pemodule, :position_x, :position_y, :nb_input_attr, :nb_output_attr, :view_id, :color

  belongs_to :pemodule
  belongs_to :project, :touch => true
  belongs_to :view    # the current selected view

  belongs_to :guw_model, class_name: "Guw::GuwModel", dependent: :delete
  belongs_to :ge_model, class_name: "Ge::GeModel", dependent: :delete
  belongs_to :expert_judgement_instance, class_name: "ExpertJudgement::Instance", dependent: :delete
  belongs_to :wbs_activity, dependent: :delete

  has_many :guw_unit_of_work_groups, class_name: "Guw::GuwUnitOfWorkGroup"
  has_many :guw_unit_of_works, :through => :guw_unit_of_work_groups, class_name: "Guw::GuwUnitOfWork"

  has_many :estimation_values, :dependent => :destroy
  has_many :input_cocomos
  has_many :factors, :through => :input_cocomos
  has_many :organization_uow_complexities, :through => :factors
  has_many :views_widgets, dependent: :delete_all

  has_and_belongs_to_many :pbs_project_elements

  has_many :first_module_projects, :class_name => 'AssociatedModuleProject', :foreign_key => 'module_project_id'
  has_many :associated_module_projects, :through => :first_module_projects<commit_msg>big bug on delete module project (dependent destroy remove)<commit_after>#encoding: utf-8
#############################################################################
#
# Estimancy, Open Source project estimation web application
# Copyright (c) 2014 Estimancy (http://www.estimancy.com)
#
#    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.
#
#    ======================================================================
#
# ProjEstimate, Open Source project estimation web application
# Copyright (c) 2013 Spirula (http://www.spirula.fr)
#
#    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 Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################


class ModuleProject < ActiveRecord::Base
  attr_accessible  :project_id, :pemodule_id, :pemodule, :position_x, :position_y, :nb_input_attr, :nb_output_attr, :view_id, :color

  belongs_to :pemodule
  belongs_to :project, :touch => true
  belongs_to :view    # the current selected view

  belongs_to :guw_model, class_name: "Guw::GuwModel"
  belongs_to :ge_model, class_name: "Ge::GeModel"
  belongs_to :expert_judgement_instance, class_name: "ExpertJudgement::Instance"
  belongs_to :wbs_activity

  has_many :guw_unit_of_work_groups, class_name: "Guw::GuwUnitOfWorkGroup"
  has_many :guw_unit_of_works, :through => :guw_unit_of_work_groups, class_name: "Guw::GuwUnitOfWork"

  has_many :estimation_values, :dependent => :destroy
  has_many :input_cocomos
  has_many :factors, :through => :input_cocomos
  has_many :organization_uow_complexities, :through => :factors
  has_many :views_widgets, dependent: :delete_all

  has_and_belongs_to_many :pbs_project_elements

  has_many :first_module_projects, :class_name => 'AssociatedModuleProject', :foreign_key => 'module_project_id'
  has_many :associated_module_projects, :through => :first_module_projects
{'fraction_non_alphanumeric': 0.14705882352941177, 'fraction_numerical': 0.0037187288708586883, 'mean_word_length': 5.2481520591341075, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '6859350', 'n_tokens_mistral': 1714, 'n_tokens_neox': 1652, 'n_words': 591}