Ballot's owner fullname fix, time to ballot's expiration fix, Not valid mining key alert fix

This commit is contained in:
viktor 2017-06-16 21:25:11 +03:00
parent f959f26c9d
commit e668d26736
6 changed files with 49 additions and 13 deletions

View File

@ -95,13 +95,22 @@ function addValidator(api, func, validatorViewObj, address, contractAddr, cb) {
});
}
function showAlert(err, msg) {
if (err.type != "REQUEST_REJECTED") {
if (!err) {
swal({
title: "Error",
text: msg,
type: "error"
});
}
else {
if (err.type != "REQUEST_REJECTED") {
swal({
title: "Error",
text: msg,
type: "error"
});
}
}
}
function generateBallotID() {
var min = 10000000;
@ -433,7 +442,7 @@ function formatDate(date, format, utc) {
};
function getDateDiff(dateStart, dateEnd) {
var periodInMinutes = Math.floor((dateEnd - dateStart)/60);
var periodInMinutes = Math.floor((dateEnd - dateStart)/60) + 1;
if (periodInMinutes <= 0) {
return "00:00";
}
@ -442,7 +451,7 @@ function getDateDiff(dateStart, dateEnd) {
var hoursStr = hours.toString();
if (hours < 9)
hoursStr = "0" + hours.toString();
var minutes = periodInMinutes%60;
var minutes = periodInMinutes%60 + 1;
var minutesStr = minutes.toString();
if (minutes < 9)
minutesStr = "0" + minutes.toString();
@ -752,7 +761,7 @@ function ballotViewObject(ballotID, ballotPropsObj, isVotingEnabled) {
<div class="vote-header">
<div class="vote-person left">
<img src="./assets/images/person.png" alt="" class="vote-person-img">
<p class="vote-person-name">` + (ballotPropsObj["owner"]?ballotPropsObj["owner"]:`Allison Williams`) + `</p>
<p class="vote-person-name">` + (ballotPropsObj["owner"]?ballotPropsObj["owner"]:``) + `</p>
<div class="vote-person-create">` + formatDate(new Date(parseInt(ballotPropsObj["createdAt"])*1000), "MM/dd/yyyy h:mm TT") + `</div>
</div>
<div class="vote-time right">
@ -946,7 +955,7 @@ $(function() {
var isAddress = web3.isAddress($("#key").val());
if (!isAddress) {
$(".loading-container").hide();
showAlert(err, "Incorrect mining key");
showAlert(null, "Incorrect mining key");
return;
}

View File

@ -1,9 +1,18 @@
function showAlert(err, msg) {
if (err.type != "REQUEST_REJECTED") {
if (!err) {
swal({
title: "Error",
text: msg,
type: "error"
});
}
else {
if (err.type != "REQUEST_REJECTED") {
swal({
title: "Error",
text: msg,
type: "error"
});
}
}
}

View File

@ -83,7 +83,7 @@ function formatDate(date, format, utc) {
};
function getDateDiff(dateStart, dateEnd) {
var periodInMinutes = Math.floor((dateEnd - dateStart)/60);
var periodInMinutes = Math.floor((dateEnd - dateStart)/60) + 1;
if (periodInMinutes <= 0) {
return "00:00";
}
@ -92,7 +92,7 @@ function getDateDiff(dateStart, dateEnd) {
var hoursStr = hours.toString();
if (hours < 9)
hoursStr = "0" + hours.toString();
var minutes = periodInMinutes%60;
var minutes = periodInMinutes%60 + 1;
var minutesStr = minutes.toString();
if (minutes < 9)
minutesStr = "0" + minutes.toString();

View File

@ -46,7 +46,7 @@ function ballotViewObject(ballotID, ballotPropsObj, isVotingEnabled) {
<div class="vote-header">
<div class="vote-person left">
<img src="./assets/images/person.png" alt="" class="vote-person-img">
<p class="vote-person-name">` + (ballotPropsObj["owner"]?ballotPropsObj["owner"]:`Allison Williams`) + `</p>
<p class="vote-person-name">` + (ballotPropsObj["owner"]?ballotPropsObj["owner"]:``) + `</p>
<div class="vote-person-create">` + formatDate(new Date(parseInt(ballotPropsObj["createdAt"])*1000), "MM/dd/yyyy h:mm TT") + `</div>
</div>
<div class="vote-time right">

View File

@ -121,7 +121,7 @@ $(function() {
var isAddress = web3.isAddress($("#key").val());
if (!isAddress) {
$(".loading-container").hide();
showAlert(err, "Incorrect mining key");
showAlert(null, "Incorrect mining key");
return;
}

File diff suppressed because one or more lines are too long