Skip to content

Commit

Permalink
Merge pull request #133 from korobprog/fix/team-report-month
Browse files Browse the repository at this point in the history
Fix/team report month
  • Loading branch information
vraja-nayaka authored Mar 9, 2024
2 parents 634c820 + f916380 commit 2441013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/common/src/features/downloadUsersStatistic/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Props = {

export const UsersStatistic = (props: Props) => {
const [selectedYear, setSelectedYear] = useState(0);
const [selectedMonth, setSelectedMonth] = useState(0);
const [selectedMonth, setSelectedMonth] = useState<string>();
const [buttonDisabled, setButtonDisabled] = useState(true);
const { Title } = Typography;

Expand All @@ -68,13 +68,13 @@ export const UsersStatistic = (props: Props) => {
const operations = await getDocs(operationsQuery);
let monthlyBooks: any = {};
let exportTable: any = [];
const pickedMonth = months[selectedMonth - 1];
const pickedMonth = months[Number(selectedMonth) - 1];
operations.forEach((doc) => {
const { date, books, userName = "Unknown", totalCount = 0, totalPoints = 0 } = doc.data();
const year = new Date(date).getFullYear() ?? "Unknown";
const month = new Date(date).getMonth() ?? "Unknown";
const bookHashMap = $booksHashMap.getState();
if (year === selectedYear || month === Number(selectedMonth) - 1) {
if (year === selectedYear && month === Number(selectedMonth) - 1) {
monthlyBooks[userName] = monthlyBooks?.[userName] ?? {};
monthlyBooks[userName]["Количество книг"] =
(monthlyBooks?.[userName]?.["Количество книг"] || 0) + totalCount;
Expand Down Expand Up @@ -157,7 +157,7 @@ export const UsersStatistic = (props: Props) => {
const onChange = (date: any, dateString: any) => {
const [month, year] = dateString.split(".");
setSelectedMonth(month);
setSelectedYear(year);
setSelectedYear(Number(year));
setButtonDisabled(false);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/tracker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tracker",
"version": "1.1.3",
"version": "1.1.4",
"description": "BookTracker",
"scripts": {
"start": "craco start --mode staging",
Expand Down

0 comments on commit 2441013

Please sign in to comment.