Skip to content

Commit

Permalink
resolve #52
Browse files Browse the repository at this point in the history
  • Loading branch information
CherrelleTucker authored Feb 7, 2024
1 parent a57def5 commit 0b41730
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
15 changes: 11 additions & 4 deletions inDocActionItemsWebApp/Page.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,17 @@ <h1>In-doc action item collection tool</h1>
<p>Enter the the Document ID or URL of a Google Document that you would like to process.
Ensure that the document meets the following requirements:
<ul>
<p> <li>The document should have a section for Attendees at the top, in the format "Attendees:" followed by names separated by a comma. This list is where the program collects the names associated with each action item. </p>
<p> <li>The document must contain action items in the format "Action:" followed by the name of the person assigned, then the action. Ex: "Action: Amy email purchasing about req 385."" </li></p>
<p> <li> Note: Text with hyperlinks is transferred as plain text to the table.
</ul></p>
<li>
The document must contain action items in the format "Action:". The script assumes that the first word following the name of the person assigned, then the action is the paragraph following.
<p>Example 1: "Action: <span style="color:green;">Amy</span> <span style="color:blue;">email purchasing about req 385.</span>" <br>
Owner = "<span style="color:green;">Amy</span>" Action Item = "<span style="color:blue;">email purchasing about req 385.</span>" </p>
<p>Example 2: Action:"<span style="color:green;">Copy</span> <span style="color:blue;">2024 boards as 20XX boards and update screenshots/demo videos.</span>" <br>
Owner = "<span style="color:green;">Copy</span>" Action = "<span style="color:blue;">2024 boards as 20XX boards and update screenshots/demo videos.</span>"</p>
</li>
<li>
Note: Text with hyperlinks is transferred as plain text to the table.
</li>
</ul>
Once the document is processed, the action items will be populated in a 3 column table at the end of the document with the column headers "Status" "Owner""Action". If such a table does not already exist, one will be generated and you may then apply your desired formatting.
</p>
<p>Example of an acceptable document with collected action items populated in a table can be found here: <a href="https://drive.google.com/uc?id=1nn1Hxk3kHBpNUsEeSUBOnK7dTAAb4V76" target="_Example Agenda">Example Document </a>
Expand Down
23 changes: 9 additions & 14 deletions inDocActionItemsWebApp/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Notes:

///////////////////////////////////////////////////

// Helper function that extracts attendees' names from the document.
function extractAttendees(body) {
// Former helper function that extracts attendees' names from the document. Updates to streamline process by identifying the word following "Action:" as the Action Owner name regardless of inclusion in the Attendees list have rendered this function obsolete.
/*function extractAttendees(body) {
const attendees = [];
const paragraphs = body.getParagraphs();
Expand All @@ -69,7 +69,7 @@ function extractAttendees(body) {
}
return attendees;
}
}*/

// Helper function that creates a new action item table in the document.
function createSecondTable(body) {
Expand Down Expand Up @@ -132,7 +132,6 @@ function populateActionInTable(table, actionItem) {
newRow.appendTableCell().setText(actionItem.action); // Action cell
}


// Helper function: extractActionsFromTable
function extractActionsFromTable(table) {
const actionList = [];
Expand Down Expand Up @@ -218,7 +217,6 @@ function actionsFromParagraphs(documentId) {
const body = document.getBody();
const actionsPhrase = 'Action:';
let actionList = [];
const names = extractAttendees(body);

const paragraphs = body.getParagraphs();
paragraphs.forEach(paragraph => {
Expand All @@ -230,13 +228,11 @@ function actionsFromParagraphs(documentId) {
const words = actionText.split(' ');

if (words.length > 0) {
const potentialOwner = words[0];
if (names.includes(potentialOwner)) {
const actionDescription = words.slice(1).join(' ').trim();
const isDuplicate = actionList.some(item => item.name === potentialOwner && item.action === actionDescription);
if (!isDuplicate) {
actionList.push({ name: potentialOwner, action: actionDescription });
}
const potentialOwner = words[0]; // Assuming the first word is always the owner
const actionDescription = words.slice(1).join(' ').trim();
const isDuplicate = actionList.some(item => item.name === potentialOwner && item.action === actionDescription);
if (!isDuplicate) {
actionList.push({ name: potentialOwner, action: actionDescription });
}
}
}
Expand Down Expand Up @@ -291,5 +287,4 @@ function testScriptWithDocumentUrl(url) {
}
}

testScriptWithDocumentUrl('https://docs.google.com/document/d/1TklfjJCp4tt8scjSOlQn7pxrByI_6KTf0JMnD8y7bl8/edit');

testScriptWithDocumentUrl('https://docs.google.com/document/d/1TklfjJCp4tt8scjSOlQn7pxrByI_6KTf0JMnD8y7bl8/edit');

0 comments on commit 0b41730

Please sign in to comment.