diff --git a/server/controllers/BlockchainBlock.ts b/server/controllers/BlockchainBlock.ts
index 9105136..2624244 100644
--- a/server/controllers/BlockchainBlock.ts
+++ b/server/controllers/BlockchainBlock.ts
@@ -304,16 +304,8 @@ export class BlockchainBlockController {
* produces:
* - application/json
* parameters:
- * - name: FromDate
- * description: Enter the From date
- * in: query
- * type: string
- * - name: ToDate
- * description: Enter the To date
- * in: query
- * type: string
* - name: Interval
- * description: Try to give Intevals such as 1 week/ 15 days/ 30 days/ 60 days/ 3 months
+ * description: try to get Date
* in: query
* type: string
* responses:
@@ -1202,71 +1194,37 @@ export class BlockchainBlockController {
const TotalDifficultyNBlockRequestData: TotalDifficultyNBlockDto =
request.query;
if (TotalDifficultyNBlockRequestData.Interval) {
- var timeIntervalQry =
- "timestamp at time zone '" +
- process.env.TIME_ZONE +
- "' > current_date - interval '" +
- TotalDifficultyNBlockRequestData.Interval +
- "'";
- } else if (
- TotalDifficultyNBlockRequestData.FromDate ||
- TotalDifficultyNBlockRequestData.ToDate
- ) {
- let fromdate = moment(TotalDifficultyNBlockRequestData.FromDate)
- .utc()
- .format('YYYY-MM-DD');
- let todate = moment(TotalDifficultyNBlockRequestData.ToDate)
- .utc()
- .format('YYYY-MM-DD');
-
- var timeIntervalQry =
- "timestamp at time zone '" +
- process.env.TIME_ZONE +
- "' BETWEEN SYMMETRIC '" +
- fromdate +
- "' AND '" +
- todate +
- "'";
- } else {
- var timeIntervalQry =
- "timestamp at time zone '" +
- process.env.TIME_ZONE +
- "' > current_date - interval '1 day'";
- }
+ var IntervalDate = TotalDifficultyNBlockRequestData.Interval;
+ }else {
+ var current_date = Date.now();
+ var IntervalDate = "";
+ IntervalDate = moment(current_date).format('YYYY-MM-DD');
+ }
const BlockQuery = await getConnection(Global.network)
.query(
- "select 1 as hash, max(total_difficulty_cuckaroo) as total_difficulty_cuckaroo, \
- max(total_difficulty_cuckatoo) as total_difficulty_cuckatoo, \
- max(total_difficulty_progpow) as total_difficulty_progpow, \
- max(total_difficulty_randomx) as total_difficulty_randomx, date(DATE_TRUNC('day', timestamp at time zone '" +
- process.env.TIME_ZONE +
- "')) as date, count(hash) as blocks \
- from blockchain_block where " +
- timeIntervalQry +
- "group by DATE_TRUNC('day', timestamp at time zone '" +
- process.env.TIME_ZONE +
- "') order by date",
+ "SELECT bb.height, coalesce(max(bb.alter), 0) as alter, bb.timestamp FROM (SELECT height, EXTRACT(EPOCH FROM (timestamp - LAG(timestamp) OVER (ORDER BY timestamp))) AS alter, timestamp FROM blockchain_block where timestamp::date = date '"+IntervalDate+"' order by height asc) as bb group by bb.height , bb.timestamp;",
)
.catch(err_msg => {
next(err_msg);
});
let date = [],
- blockDate = [],
+ alter = [],
blocks = [];
BlockQuery.forEach(e => {
- blockDate.push(moment(e.date).format('YYYY-MM-DD'));
- blocks.push(parseInt(e.blocks));
+ //date.push(moment(e.timestamp).format('YYYY-MM-DD HH:MM:SS'));
+ alter.push(parseInt(e.alter));
+ blocks.push(parseInt(e.height));
});
response.status(200).json({
status: 200,
timestamp: Date.now(),
message: 'Block Interval Data fetched Successfully',
response: {
- Date: date,
+ //Date: date,
Blocks: blocks,
- blockDate:blockDate
+ alter:alter
},
});
} catch (error) {
diff --git a/server/i18n/de.json b/server/i18n/de.json
index 6044647..7afb9bc 100644
--- a/server/i18n/de.json
+++ b/server/i18n/de.json
@@ -43,6 +43,7 @@
"TARGET_DIFFICULTY" : "Zielschwierigkeit",
"TRANSACTIONS_BY_TIME" : "Transaktionen im Zeitverlauf",
"BLOCKS" : "Blöcke",
+ "BLOCKSINTERVAL" : "Intervall-S / W-Blöcke",
"BLOCK" : "Block",
"BLOCKS_MINED" : "Blöcke abgebaut",
"TRANSACTION_FEES" : "Transkationsgebühren",
diff --git a/server/i18n/en.json b/server/i18n/en.json
index b9f73e5..198f206 100644
--- a/server/i18n/en.json
+++ b/server/i18n/en.json
@@ -43,6 +43,7 @@
"TARGET_DIFFICULTY" : "Target Difficulty",
"TRANSACTIONS_BY_TIME" : "Transactions over time",
"BLOCKS" : "Blocks",
+ "BLOCKSINTERVAL" : "Interval B/W Blocks",
"BLOCK" : "Block",
"BLOCKS_MINED" : "Blocks Mined",
"TRANSACTION_FEES" : "Transaction Fees",
diff --git a/src/app/view/graph-view/graph-detail/graph-detail.component.html b/src/app/view/graph-view/graph-detail/graph-detail.component.html
index 9b59282..2ef38dc 100644
--- a/src/app/view/graph-view/graph-detail/graph-detail.component.html
+++ b/src/app/view/graph-view/graph-detail/graph-detail.component.html
@@ -96,7 +96,7 @@
-->