Skip to content

Commit

Permalink
fix: leave a day for OpenDigger to generate and export the data of la…
Browse files Browse the repository at this point in the history
…st month (#635)
  • Loading branch information
tyn1998 authored Mar 30, 2023
1 parent b36e624 commit 2b3ac8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For more information please refer to [Installation Guide](./INSTALLATION.md).

## Datasource

`Hypercrx` consumes data that generated by [OpenDigger](https://github.com/X-lab2017/open-digger), which is an open source project that focuses on open source analysis.
`Hypercrx` consumes data that generated by [OpenDigger](https://github.com/X-lab2017/open-digger), which is an open source project that focuses on open source analysis. The data should be updated in the 2nd day of every month.

## Dashboards 🔥🔥🔥

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Language : [English](./README.md) | 中文

## 数据来源

`Hypercrx`呈现的所有数据都由[OpenDigger](https://github.com/X-lab2017/open-digger)产生。OpenDigger是一个聚焦于开源分析的开源项目。
`Hypercrx`呈现的所有数据都由[OpenDigger](https://github.com/X-lab2017/open-digger)产生。OpenDigger是一个聚焦于开源分析的开源项目。数据会在每个月第二天更新。

## 可视化看板 🔥🔥🔥

Expand Down
6 changes: 5 additions & 1 deletion src/utils/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export const generateDataByMonth = (originalData: any) => {
});
const oldestMonth = orderedMonths[0];
const now = new Date();
now.setMonth(now.getMonth() - 1);
if (now.getDate() === 1) {
// data for last month is not ready in the first day of the month (#595)
now.setDate(0); // a way to let month - 1
}
now.setDate(0); // see issue #632
const newestMonth =
now.getFullYear() + '-' + (now.getMonth() + 1).toString().padStart(2, '0');
// insert no-event months (assigned to 0) and generate final data
Expand Down

0 comments on commit 2b3ac8a

Please sign in to comment.