Skip to content

Commit 0f6d77c

Browse files
author
Rob Myers
committed
Fix #116 - Update ToT tool with new question asking for date first published under grant.
1 parent a407cd9 commit 0f6d77c

File tree

2 files changed

+42
-8
lines changed

2 files changed

+42
-8
lines changed

wordpress-plugin/js/questions.js

+26
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,31 @@ Questions.s1q1bi = {
7272

7373
};
7474

75+
// When was the work first published under the grant?
76+
77+
Questions.s1q1bii = {
78+
section: 1,
79+
question: 'When was the work first published under the grant?',
80+
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>.',
81+
variable: 'grant_pub_year',
82+
input: 'year',
83+
validate: function () {
84+
var errors = Validation.validDate();
85+
if (errors == false) {
86+
var year = parseInt(jQuery('.text-question').val());
87+
if (year < Values.creation_year) {
88+
errors = 'Year of publication under grant cannot be earlier than year of creation.';
89+
} else if (year < Values.pub_year) {
90+
errors = 'Year of publication under grant cannot be earlier than year of initial publication.';
91+
} /* else if (year < Values.k_year) {
92+
errors = 'Year of publication under grant cannot be earlier than year of grant.';
93+
}*/
94+
}
95+
return errors;
96+
}
97+
};
98+
99+
75100
// Works from 1989 and earlier usually display a copyright notice. Did the work have a copyright notice?
76101

77102
Questions.s1q1bi2 = {
@@ -138,6 +163,7 @@ Questions.s1q1f = {
138163
values: ['yes', 'no', 'maybe']
139164
};
140165

166+
141167
////////////////////////////////////////////////////////////////////////////////
142168
// Section Two
143169
////////////////////////////////////////////////////////////////////////////////

wordpress-plugin/js/rules.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,16 @@ Rules.section304Analysis = function () {
151151

152152
Rules.section203Analysis = function () {
153153
var result = 's2q2a';
154+
var year_to_use = Values.grant_pub_year || Values.pub_year;
154155
if (Values.k_year > 1977) {
155156
Rules.addFlag('F.iii');
156157
if (Values.pub_right == 'yes' ) {
157-
if (Values.pub_year != undefined) {
158-
Values.term_begin = Math.min(Values.pub_year + 35 , Values.k_year + 40);
158+
if (year_to_use != undefined) {
159+
Values.term_begin = Math.min(year_to_use + 35 , Values.k_year + 40);
159160
} else {
160161
Values.term_begin = Values.k_year + 40;
161162
}
162-
} else if ((Values.pub_year != Values.k_year)
163+
} else if ((year_to_use != Values.k_year)
163164
|| (Values.pub_right == 'no')) {
164165
Values.term_begin = Values.k_year + 35;
165166
}
@@ -175,8 +176,8 @@ Rules.section203Analysis = function () {
175176
}
176177
if (Values.pub_right == 'maybe') {
177178
Values.p_term_begin = Values.k_year + 40;
178-
if (Values.pub_year != undefined) {
179-
Values.p_term_begin = Math.min(Values.pub_year + 35,
179+
if (year_to_use != undefined) {
180+
Values.p_term_begin = Math.min(year_to_use + 35,
180181
Values.p_term_begin);
181182
}
182183
Values.p_term_end = Values.p_term_begin + 5;
@@ -208,12 +209,19 @@ Rules.s1q1a = 's1q1b';
208209
// Has the work been published?
209210

210211
Rules.s1q1b = Rules.simpleYesNoRule('work_published',
211-
's1q1bi',
212-
's1q1c');
212+
's1q1bi',
213+
's1q1c');
213214

214215
// When was the work first published?
215216

216-
Rules.s1q1bi = function () {
217+
Rules.s1q1bi = 's1q1bii';
218+
219+
// When was the work first published under the grant?
220+
// Note that the condition is based on s1q1b, we are inserting this question
221+
// after 'When was the work first published?' and *then* going on to the
222+
// questions about registration/notices or not.
223+
224+
Rules.s1q1bii = function () {
217225
var result = undefined;
218226
if (Values.pub_year < 1923) {
219227
result = Rules.conclusion('B.viii');

0 commit comments

Comments
 (0)