mirror of
https://github.com/seigler/govobject-proposal
synced 2025-07-27 23:06:09 +00:00
added parameter bufferdays to easily change number of days before next superblock before we automatically select start date of next budget cycle
This commit is contained in:
parent
392e53d336
commit
87402e1389
1 changed files with 7 additions and 9 deletions
16
index.html
16
index.html
|
@ -14,7 +14,8 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var Bitcore = require('bitcore-lib-dash');
|
var Bitcore = require('bitcore-lib-dash');
|
||||||
|
//number of days to have as buffer for proposal start date before jumping to next month
|
||||||
|
var bufferdays = 3;
|
||||||
eventToListenTo = 'block';
|
eventToListenTo = 'block';
|
||||||
room = 'inv';
|
room = 'inv';
|
||||||
|
|
||||||
|
@ -109,19 +110,18 @@
|
||||||
start_epoch.append(optionsStart.join(""));
|
start_epoch.append(optionsStart.join(""));
|
||||||
end_epoch.append(optionsEnd.join(""));
|
end_epoch.append(optionsEnd.join(""));
|
||||||
|
|
||||||
console.log('blocks left to next superblock: ' + (selectblock - blockheight));
|
//console.log('blocks left to next superblock: ' + (selectblock - blockheight));
|
||||||
console.log('selectblock: ' + selectblock);
|
//console.log('selectblock: ' + selectblock);
|
||||||
console.log('budgetPaymentCycleBlocks: ' + budgetPaymentCycleBlocks);
|
//console.log('budgetPaymentCycleBlocks: ' + budgetPaymentCycleBlocks);
|
||||||
|
|
||||||
//if next superblock is less than 3 days (60*24*3/2.6) away, select next month's superblock by default so proposal has more time to be voted upon
|
//if next superblock is less than 3 days (60*24*3/2.6) away, select next month's superblock by default so proposal has more time to be voted upon
|
||||||
if (selectblock - blockheight < 1661) {
|
if (selectblock - blockheight < (60*24*bufferdays/2.6)) {
|
||||||
selectblock += budgetPaymentCycleBlocks;
|
selectblock += budgetPaymentCycleBlocks;
|
||||||
blockdiff = selectblock - blockheight;
|
blockdiff = selectblock - blockheight;
|
||||||
nextsuperblocktimestamp = $.now() + blockdiff * (2.6 * 60 * 1000);
|
nextsuperblocktimestamp = $.now() + blockdiff * (2.6 * 60 * 1000);
|
||||||
var selectstartdate = $.datepicker.formatDate('yy-mm-dd', new Date(nextsuperblocktimestamp));
|
var selectstartdate = $.datepicker.formatDate('yy-mm-dd', new Date(nextsuperblocktimestamp));
|
||||||
console.log('new selectblock: ' + selectblock);
|
|
||||||
start_epoch.val(selectstartdate);
|
start_epoch.val(selectstartdate);
|
||||||
nextsuperblocktimestamp = nextsuperblocktimestamp + 16616 * (2.6 * 60 * 1000);
|
nextsuperblocktimestamp = nextsuperblocktimestamp + budgetPaymentCycleBlocks * (2.6 * 60 * 1000);
|
||||||
var selectenddate = $.datepicker.formatDate('yy-mm-dd', new Date(nextsuperblocktimestamp));
|
var selectenddate = $.datepicker.formatDate('yy-mm-dd', new Date(nextsuperblocktimestamp));
|
||||||
end_epoch.val(selectenddate);
|
end_epoch.val(selectenddate);
|
||||||
}
|
}
|
||||||
|
@ -129,9 +129,7 @@
|
||||||
|
|
||||||
//change end date to one month after start date by default
|
//change end date to one month after start date by default
|
||||||
$('#start_epoch').change(function() {
|
$('#start_epoch').change(function() {
|
||||||
console.log('start_epoch changed');
|
|
||||||
var start_time = $('#start_epoch').val();
|
var start_time = $('#start_epoch').val();
|
||||||
console.log('start_epoch: ' + start_time);
|
|
||||||
var startindex = $('#start_epoch').find(":selected").index();
|
var startindex = $('#start_epoch').find(":selected").index();
|
||||||
var endindex = startindex + 1;
|
var endindex = startindex + 1;
|
||||||
$('#end_epoch :nth-child(' + endindex + ')').prop('selected', true);
|
$('#end_epoch :nth-child(' + endindex + ')').prop('selected', true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue