Merge pull request #3320 from aignatov-bio/ai-sci-5718-remove-report-name-uniqness

Remove report name uniqueness [SCI-5718]
This commit is contained in:
Alex Kriuchykhin 2021-05-13 11:46:34 +02:00 committed by GitHub
commit dde82423f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View file

@ -1057,13 +1057,11 @@ function reportHandsonTableConverter() {
});
$('.reports-new').on('click', '#saveAsNewReport', function(e) {
var params = getReportData();
params.report.name = 'New ' + params.report.name;
e.preventDefault();
$.ajax({
url: this.dataset.createUrl,
type: 'POST',
data: JSON.stringify(params),
data: JSON.stringify(getReportData()),
contentType: 'application/json; charset=utf-8',
success: function() {},
error: function(jqxhr) {

View file

@ -12,8 +12,7 @@ class Report < ApplicationRecord
auto_strip_attributes :name, :description, nullify: false
validates :name,
length: { minimum: Constants::NAME_MIN_LENGTH,
maximum: Constants::NAME_MAX_LENGTH },
uniqueness: { scope: %i(user_id project_id), case_sensitive: false }
maximum: Constants::NAME_MAX_LENGTH }
validates :description, length: { maximum: Constants::TEXT_MAX_LENGTH }
validates :project, presence: true
validates :user, presence: true