Commit 05edc72d6c52cba79f904450f789fdef869e45cf
1 parent
f110f276
Exists in
dev
fixing dates suggestions when creating or editing a period
Showing
3 changed files
with
51 additions
and
64 deletions
Show diff stats
src/core/pyros_django/pyros/settings.py
... | ... | @@ -399,7 +399,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' |
399 | 399 | |
400 | 400 | python_version = subprocess.run( "python --version | cut -d ' ' -f 2 | cut -d '.' -f 1,2",shell=True,stdout=subprocess.PIPE,universal_newlines=True) |
401 | 401 | python_version = python_version.stdout |
402 | -today = "2021-11-02" | |
402 | +today = "2021-11-03" | |
403 | 403 | django_version_major,django_version_minor = django.VERSION[:2][0],django.VERSION[:2][1] |
404 | -pyros_version = "0.2.11.0" | |
404 | +pyros_version = "0.2.11.1" | |
405 | 405 | VERSION_NUMBER = f"{pyros_version}_{django_version_major}.{django_version_minor}_{python_version}_{today}" |
406 | 406 | \ No newline at end of file | ... | ... |
src/core/pyros_django/scientific_program/templates/scientific_program/create_period.html
... | ... | @@ -149,33 +149,33 @@ function loadDate(){ |
149 | 149 | + parseInt($("#id_validation_duration").val()) + parseInt($("#id_notification_duration").val()); |
150 | 150 | date = period_start_date.addDays(-proposal_duration); |
151 | 151 | submission_start_date = date; |
152 | - $("#submission_duration_date").html(date.toLocaleDateString("en-GB")); | |
152 | + $("#submission_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
153 | 153 | |
154 | - duration_value = parseInt($("#id_evaluation_duration").val()) | |
155 | - date = submission_start_date.addDays(duration_value); | |
154 | + previous_duration = parseInt($("#id_submission_duration").val()) | |
155 | + date = submission_start_date.addDays(previous_duration); | |
156 | 156 | evaluation_start_date = date; |
157 | - $("#evaluation_duration_date").html(date.toLocaleDateString("en-GB")); | |
157 | + $("#evaluation_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
158 | 158 | |
159 | - duration_value = parseInt($("#id_validation_duration").val()) | |
160 | - date = evaluation_start_date.addDays(duration_value); | |
159 | + previous_duration = parseInt($("#id_evaluation_duration").val()) | |
160 | + date = evaluation_start_date.addDays(previous_duration); | |
161 | 161 | validation_start_date = date; |
162 | - $("#validation_duration_date").html(date.toLocaleDateString("en-GB")); | |
162 | + $("#validation_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
163 | 163 | |
164 | - duration_value = parseInt($("#id_notification_duration").val()) | |
165 | - date = validation_start_date.addDays(duration_value); | |
166 | - $("#notification_duration_date").html(date.toLocaleDateString("en-GB")); | |
164 | + previous_duration = parseInt($("#id_validation_duration").val()) | |
165 | + date = validation_start_date.addDays(previous_duration); | |
166 | + $("#notification_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
167 | 167 | |
168 | 168 | duration_value = parseInt($("#id_exploitation_duration").val()) |
169 | 169 | date = period_start_date.addDays(duration_value); |
170 | - $("#exploitation_duration_date").html(date.toLocaleDateString("en-GB")); | |
170 | + $("#exploitation_duration_date").html(date.toLocaleDateString("en-GB")+ " (end date)"); | |
171 | 171 | |
172 | 172 | duration_value = parseInt($("#id_property_of_data_duration").val()) |
173 | 173 | date = period_start_date.addDays(duration_value); |
174 | - $("#property_of_data_duration_date").html(date.toLocaleDateString("en-GB")); | |
174 | + $("#property_of_data_duration_date").html(date.toLocaleDateString("en-GB") + " (end date)"); | |
175 | 175 | |
176 | 176 | duration_value = parseInt($("#id_data_accessibility_duration").val()) |
177 | 177 | date = period_start_date.addDays(duration_value); |
178 | - $("#data_accessibility_duration_date").html(date.toLocaleDateString("en-GB")); | |
178 | + $("#data_accessibility_duration_date").html(date.toLocaleDateString("en-GB") + " (end date)"); | |
179 | 179 | } |
180 | 180 | // Set date after page is loaded |
181 | 181 | $( document ).ready(function() { | ... | ... |
src/core/pyros_django/scientific_program/templates/scientific_program/period_detail_edit.html
... | ... | @@ -138,6 +138,7 @@ Date.prototype.addDays = function(days) { |
138 | 138 | return date; |
139 | 139 | } |
140 | 140 | |
141 | + | |
141 | 142 | function loadDate(){ |
142 | 143 | split = $("#start_date_picker").val().split("/"); |
143 | 144 | period_start_date = new Date(split[2],split[1]-1,split[0]); |
... | ... | @@ -146,87 +147,73 @@ function loadDate(){ |
146 | 147 | // set date for each duration |
147 | 148 | |
148 | 149 | duration_value = parseInt($("#id_submission_duration").val()) |
149 | - date = period_start_date.addDays(-duration_value); | |
150 | - $("#submission_duration_date").html(date.toLocaleDateString("en-GB")); | |
151 | - | |
152 | - duration_value = parseInt($("#id_evaluation_duration").val()) | |
153 | - date = period_start_date.addDays(-duration_value); | |
154 | - $("#evaluation_duration_date").html(date.toLocaleDateString("en-GB")); | |
155 | - | |
156 | - duration_value = parseInt($("#id_validation_duration").val()) | |
157 | - date = period_start_date.addDays(-duration_value); | |
158 | - $("#validation_duration_date").html(date.toLocaleDateString("en-GB")); | |
159 | - | |
160 | - duration_value = parseInt($("#id_notification_duration").val()) | |
161 | - date = period_start_date.addDays(-duration_value); | |
162 | - $("#notification_duration_date").html(date.toLocaleDateString("en-GB")); | |
150 | + proposal_duration = parseInt($("#id_submission_duration").val()) + parseInt($("#id_evaluation_duration").val()) | |
151 | + + parseInt($("#id_validation_duration").val()) + parseInt($("#id_notification_duration").val()); | |
152 | + date = period_start_date.addDays(-proposal_duration); | |
153 | + submission_start_date = date; | |
154 | + $("#submission_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
155 | + | |
156 | + previous_duration = parseInt($("#id_submission_duration").val()) | |
157 | + date = submission_start_date.addDays(previous_duration); | |
158 | + evaluation_start_date = date; | |
159 | + $("#evaluation_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
160 | + | |
161 | + previous_duration = parseInt($("#id_evaluation_duration").val()) | |
162 | + date = evaluation_start_date.addDays(previous_duration); | |
163 | + validation_start_date = date; | |
164 | + $("#validation_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
165 | + | |
166 | + previous_duration = parseInt($("#id_validation_duration").val()) | |
167 | + date = validation_start_date.addDays(previous_duration); | |
168 | + $("#notification_duration_date").html(date.toLocaleDateString("en-GB") + " (start date)"); | |
163 | 169 | |
164 | 170 | duration_value = parseInt($("#id_exploitation_duration").val()) |
165 | 171 | date = period_start_date.addDays(duration_value); |
166 | - $("#exploitation_duration_date").html(date.toLocaleDateString("en-GB")); | |
172 | + $("#exploitation_duration_date").html(date.toLocaleDateString("en-GB")+ " (end date)"); | |
167 | 173 | |
168 | 174 | duration_value = parseInt($("#id_property_of_data_duration").val()) |
169 | 175 | date = period_start_date.addDays(duration_value); |
170 | - $("#property_of_data_duration_date").html(date.toLocaleDateString("en-GB")); | |
176 | + $("#property_of_data_duration_date").html(date.toLocaleDateString("en-GB") + " (end date)"); | |
171 | 177 | |
172 | 178 | duration_value = parseInt($("#id_data_accessibility_duration").val()) |
173 | 179 | date = period_start_date.addDays(duration_value); |
174 | - $("#data_accessibility_duration_date").html(date.toLocaleDateString("en-GB")); | |
180 | + $("#data_accessibility_duration_date").html(date.toLocaleDateString("en-GB") + " (end date)"); | |
175 | 181 | } |
176 | 182 | // Set date after page is loaded |
177 | 183 | $( document ).ready(function() { |
178 | 184 | loadDate(); |
179 | 185 | }); |
186 | + | |
187 | + | |
180 | 188 | // IMPORTANT NOTE : In Javascript Month count start to zero (Zero is january, 1 is february etc) |
181 | 189 | $("#id_exploitation_duration").on("input",function(){ |
182 | - duration_value = parseInt($("#id_exploitation_duration").val()) | |
183 | - split = $("#start_date_picker").val().split("/"); | |
184 | - period_start_date = new Date(split[2],split[1]-1,split[0]); | |
185 | - date = period_start_date.addDays(duration_value); | |
186 | - $("#exploitation_duration_date").html(date.toLocaleDateString("en-GB")); | |
190 | + loadDate(); | |
187 | 191 | }); |
188 | 192 | |
189 | 193 | $("#id_submission_duration").on("input",function(){ |
190 | - duration_value = parseInt($("#id_submission_duration").val()) | |
191 | - split = $("#start_date_picker").val().split("/"); | |
192 | - period_start_date = new Date(split[2],split[1]-1,split[0]); | |
193 | - date = period_start_date.addDays(duration_value); | |
194 | - $("#submission_duration_date").html(date.toLocaleDateString("en-GB")); | |
194 | + loadDate(); | |
195 | 195 | }); |
196 | 196 | |
197 | 197 | $("#id_evaluation_duration").on("input",function(){ |
198 | - duration_value = parseInt($("#id_evaluation_duration").val()) | |
199 | - split = $("#start_date_picker").val().split("/"); | |
200 | - period_start_date = new Date(split[2],split[1]-1,split[0]); | |
201 | - date = period_start_date.addDays(duration_value); | |
202 | - $("#evaluation_duration_date").html(date.toLocaleDateString("en-GB")); | |
198 | + loadDate(); | |
203 | 199 | }); |
204 | 200 | |
205 | -$("#id_notation_duration").on("input",function(){ | |
206 | - duration_value = parseInt($("#id_notation_duration").val()) | |
207 | - split = $("#start_date_picker").val().split("/"); | |
208 | - period_start_date = new Date(split[2],split[1]-1,split[0]); | |
209 | - date = period_start_date.addDays(duration_value); | |
210 | - $("#notation_duration_date").html(date.toLocaleDateString("en-GB")); | |
201 | +$("#id_validation_duration").on("input",function(){ | |
202 | + loadDate(); | |
203 | +}); | |
204 | + | |
205 | +$("#id_notification_duration").on("input",function(){ | |
206 | + loadDate(); | |
211 | 207 | }); |
212 | 208 | |
213 | 209 | |
214 | 210 | $("#id_property_of_data_duration").on("input",function(){ |
215 | - duration_value = parseInt($("#id_property_of_data_duration").val()) | |
216 | - split = $("#start_date_picker").val().split("/"); | |
217 | - period_start_date = new Date(split[2],split[1]-1,split[0]); | |
218 | - date = period_start_date.addDays(duration_value); | |
219 | - $("#property_of_data_duration_date").html(date.toLocaleDateString("en-GB")); | |
211 | + loadDate(); | |
220 | 212 | }); |
221 | 213 | |
222 | 214 | $("#id_data_accessibility_duration").on("input",function(){ |
223 | - duration_value = parseInt($("#id_data_accessibility_duration").val()) | |
224 | - split = $("#start_date_picker").val().split("/"); | |
225 | - period_start_date = new Date(split[2],split[1]-1,split[0]); | |
226 | - date = period_start_date.addDays(duration_value); | |
227 | - $("#data_accessibility_duration_date").html(date.toLocaleDateString("en-GB")); | |
215 | + loadDate(); | |
228 | 216 | }); |
229 | - | |
230 | 217 | // IMPORTANT NOTE : In Javascript Month count start to zero (Zero is january, 1 is february etc) |
231 | 218 | $(function() { |
232 | 219 | var dateFormat = "dd/mm/yy"; | ... | ... |