Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Dec 31, 2024
1 parent e90e60e commit 14163de
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
14 changes: 8 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140959,16 +140959,16 @@ function mTags({ tags }) {
;// CONCATENATED MODULE: ./src/summary.ts


function summaryMarkdown(library, date, bookStatus) {
function summaryMarkdown(library, dateType, bookStatus) {
const { BookTitle } = process.env;
return `# Updated library

${capitalize(`${bookStatus}`)}: “${BookTitle}”
Date: ${date}
Date: ${dateType.dateFinished}
Book status: ${bookStatus}
Result: ${bookStatus === "finished" && date}
${bookStatus === "finished" && date
? yearReviewSummary(library, date.slice(0, 4))
Result: ${bookStatus === "finished" && dateType.dateFinished}
${bookStatus === "finished" && dateType.dateFinished
? yearReviewSummary(library, dateType.dateFinished.slice(0, 4))
: ""}
`;
}
Expand Down Expand Up @@ -141256,7 +141256,9 @@ async function read() {
}
library = sortByDate(library);
await returnWriteFile(filename, library);
await core.summary.addRaw(summaryMarkdown(library, date, bookStatus)).write();
await core.summary
.addRaw(summaryMarkdown(library, dateType, bookStatus))
.write();
}
catch (error) {
(0,core.setFailed)(error);
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ export async function read() {
library = sortByDate(library);

await returnWriteFile(filename, library);
await summary.addRaw(summaryMarkdown(library, date, bookStatus)).write();
await summary
.addRaw(summaryMarkdown(library, dateType, bookStatus))
.write();
} catch (error) {
setFailed(error);
}
Expand Down
12 changes: 6 additions & 6 deletions src/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import {
mTopAuthors,
mTags,
} from "./summary-markdown";
import { capitalize } from "./utils";
import { capitalize, DateTypes } from "./utils";

export function summaryMarkdown(
library: NewBook[],
date: BookPayload["date"],
dateType: DateTypes,
bookStatus: BookStatus
): string {
const { BookTitle } = process.env;
return `# Updated library
${capitalize(`${bookStatus}`)}: “${BookTitle}
Date: ${date}
Date: ${dateType.dateFinished}
Book status: ${bookStatus}
Result: ${bookStatus === "finished" && date}
Result: ${bookStatus === "finished" && dateType.dateFinished}
${
bookStatus === "finished" && date
? yearReviewSummary(library, date.slice(0, 4))
bookStatus === "finished" && dateType.dateFinished
? yearReviewSummary(library, dateType.dateFinished.slice(0, 4))
: ""
}
`;
Expand Down
14 changes: 8 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,20 @@ function localDate() {
return dateFormat.format(new Date());
}

export type DateTypes = {
dateAbandoned?: string;
dateStarted?: string;
dateFinished?: string;
dateAdded?: string;
};

export function getBookStatus({
date,
bookStatus,
}: {
date?: string;
bookStatus?: BookStatus;
}): {
dateAbandoned?: string;
dateStarted?: string;
dateFinished?: string;
dateAdded?: string;
} {
}): DateTypes {
const dateValue = date ?? localDate();
switch (bookStatus) {
case "abandoned":
Expand Down

0 comments on commit 14163de

Please sign in to comment.