Skip to content

Commit

Permalink
Merge pull request #10 from kanazawarb/add-break-time-to-markdown-text
Browse files Browse the repository at this point in the history
4本実施毎に休憩を入れる
  • Loading branch information
muryoimpl authored Jan 22, 2024
2 parents 5c33129 + a63ca9a commit 4f0b02d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions command.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ function doPost(e) {
1,
).setValues([...statuses]);

// シャッフルした番号の配列をつくる
const orderNumbers = indexesNumbers(container.length);
// markdown を作り、レスポンスを返す
const mdText = makeMarkdown(container, status, index);

Expand Down Expand Up @@ -304,19 +306,23 @@ function indexesNumbers(num = 10) {
return shuffle(nums);
}

function makeMarkdown(container, status, index) {
const orderNumbers = indexesNumbers(container.length);

function makeMarkdown(orderNumbers, status, index) {
let count = 0;
let mdTable = "```\n"; // | タイトル | 時刻 | 時間 | 担当 |
let mdList = "";
for (const num of orderNumbers) {
const ary = container[num];

if (ary[index.STATUS] === status.REMOVED) continue;
if (ary[index.STATUS] === status.DELIMITED) continue;
count++;

mdTable += `| ${ary[index.TITLE]} | | | ${ary[index.NAME]} |\n`;
mdList += `- ${ary[index.TITLE]} by ${ary[index.NAME]}\n`;
if (count % 4 === 0) {
mdTable += `| 休憩 | | | |\n`;
mdList += `- 【休憩】`;
}
};
mdTable += "```";

Expand Down

0 comments on commit 4f0b02d

Please sign in to comment.