Skip to content

Commit

Permalink
Fix #116 - Update ToT tool with new question asking for date first pu…
Browse files Browse the repository at this point in the history
…blished under grant.
  • Loading branch information
Rob Myers committed Oct 10, 2017
1 parent a407cd9 commit 0f6d77c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
26 changes: 26 additions & 0 deletions wordpress-plugin/js/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,31 @@ Questions.s1q1bi = {

};

// When was the work first published under the grant?

Questions.s1q1bii = {
section: 1,
question: 'When was the work first published under the grant?',
explanation:'When a work was first published under the grant (which may be different than the the date the work was published for the first time) can factor into the timing of a termination right. Note that "publication" has a particular meaning in U.S. copyright law, as discussed in our <a href="/glossary/#publication_date">glossary</a>.',
variable: 'grant_pub_year',
input: 'year',
validate: function () {
var errors = Validation.validDate();
if (errors == false) {
var year = parseInt(jQuery('.text-question').val());
if (year < Values.creation_year) {
errors = 'Year of publication under grant cannot be earlier than year of creation.';
} else if (year < Values.pub_year) {
errors = 'Year of publication under grant cannot be earlier than year of initial publication.';
} /* else if (year < Values.k_year) {
errors = 'Year of publication under grant cannot be earlier than year of grant.';
}*/
}
return errors;
}
};


// Works from 1989 and earlier usually display a copyright notice. Did the work have a copyright notice?

Questions.s1q1bi2 = {
Expand Down Expand Up @@ -138,6 +163,7 @@ Questions.s1q1f = {
values: ['yes', 'no', 'maybe']
};


////////////////////////////////////////////////////////////////////////////////
// Section Two
////////////////////////////////////////////////////////////////////////////////
Expand Down
24 changes: 16 additions & 8 deletions wordpress-plugin/js/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,16 @@ Rules.section304Analysis = function () {

Rules.section203Analysis = function () {
var result = 's2q2a';
var year_to_use = Values.grant_pub_year || Values.pub_year;
if (Values.k_year > 1977) {
Rules.addFlag('F.iii');
if (Values.pub_right == 'yes' ) {
if (Values.pub_year != undefined) {
Values.term_begin = Math.min(Values.pub_year + 35 , Values.k_year + 40);
if (year_to_use != undefined) {
Values.term_begin = Math.min(year_to_use + 35 , Values.k_year + 40);
} else {
Values.term_begin = Values.k_year + 40;
}
} else if ((Values.pub_year != Values.k_year)
} else if ((year_to_use != Values.k_year)
|| (Values.pub_right == 'no')) {
Values.term_begin = Values.k_year + 35;
}
Expand All @@ -175,8 +176,8 @@ Rules.section203Analysis = function () {
}
if (Values.pub_right == 'maybe') {
Values.p_term_begin = Values.k_year + 40;
if (Values.pub_year != undefined) {
Values.p_term_begin = Math.min(Values.pub_year + 35,
if (year_to_use != undefined) {
Values.p_term_begin = Math.min(year_to_use + 35,
Values.p_term_begin);
}
Values.p_term_end = Values.p_term_begin + 5;
Expand Down Expand Up @@ -208,12 +209,19 @@ Rules.s1q1a = 's1q1b';
// Has the work been published?

Rules.s1q1b = Rules.simpleYesNoRule('work_published',
's1q1bi',
's1q1c');
's1q1bi',
's1q1c');

// When was the work first published?

Rules.s1q1bi = function () {
Rules.s1q1bi = 's1q1bii';

// When was the work first published under the grant?
// Note that the condition is based on s1q1b, we are inserting this question
// after 'When was the work first published?' and *then* going on to the
// questions about registration/notices or not.

Rules.s1q1bii = function () {
var result = undefined;
if (Values.pub_year < 1923) {
result = Rules.conclusion('B.viii');
Expand Down

0 comments on commit 0f6d77c

Please sign in to comment.