Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Apps Script: Add unique IDs as object keys for each wins entry #2385

Open
4 of 14 tasks
Tracked by #4134
macho-catt opened this issue Oct 20, 2021 · 20 comments
Open
4 of 14 tasks
Tracked by #4134
Assignees
Labels
Complexity: Medium Dependency An issue is blocking the completion or starting of another issue Feature: Google Apps Scripts Automation related to Google Apps Scripts P-Feature: Wins Page https://www.hackforla.org/wins/ role: back end/devOps Tasks for back-end developers size: 2pt Can be done in 7-12 hours

Comments

@macho-catt
Copy link
Member

macho-catt commented Oct 20, 2021

Dependency

Overview

To expedite the process of locating a specific wins entry, each wins entry (which is also a javascript object) should have a unique ID as a key.

Action Items

  • Follow sections 1-3 in the Wins Apps Script Development Process1. Note that in this issue you will be modifying both Apps Scripts wins-form-responses and gh-requests so setup will be required in both /google-apps-script/wins-form-responses and /google-apps-script/gh-requests
  • As described in section 3a and 3b, you will provide a dev lead with the google account you wish to use for testing, and request the dev lead to:
    • do not modify folder level access
    • share the Wins Form Admin Guide2 as VIEWER
    • share the Wins-form (Response)3 sheet as VIEWER
    • share the gh-requests doc as VIEWER
  • Continue following instructions in 3c and d. As described in 3d, you will have to make modifications to certain documents in the test folder.
    • It will not be necessary to restore any triggers, because you can execute main() in debug mode.
    • Since you will be running main() for testing, you must follow instructions in Testing WINS in a test repository
  • Continue following instructions through section 6 "Editing". As described in this section, editing can be done locally in an IDE or in the Google Drive cloud editor, and the clasp utility can be used to transfer code back and forth between the local worksation and the Google Drive as needed.
    • Modify wins so that on the creation of the javascript object for each entry, a unique ID is generated as well
    • This ID can be the row number of the wins entry
  • Ensure that even with the addition of the unique IDs as keys, the current wins page should functionally look and work the same way in your own repo.
  • Demo your changes to the website leads so they can approve and add it to the production script

Resources/Instructions

Google Apps Script
_wins-data file
wins page JS

Footnotes

  1. Wins Apps Script Development Process

  2. Wins Form Admin Guide

  3. Wins-form (Response) Sheet

@github-actions

This comment was marked as outdated.

@macho-catt macho-catt added the Fun Congrats! You finished two good first issues. Please only do one of these label Oct 20, 2021
@macho-catt macho-catt added the Feature: Google Apps Scripts Automation related to Google Apps Scripts label Nov 21, 2021
@lopezpedres lopezpedres self-assigned this Dec 15, 2021
@lopezpedres

This comment was marked as outdated.

@github-actions github-actions bot added the Status: Updated No blockers and update is ready for review label Dec 17, 2021
@github-actions github-actions bot removed the Status: Updated No blockers and update is ready for review label Dec 24, 2021
@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the 2 weeks inactive An issue that has not been updated by an assignee for two weeks label Dec 24, 2021
@lopezpedres
Copy link
Member

Progress:

Done

   39      const keyValueData = filteredRows.map((row,i) => {
   40      const valueObject = new Object();
   41      row.forEach((value, j) => {
   42       valueObject[columnHeaders[j]] = value;
   43        })
+  44     valueObject['uniqueId']= 2+ i
   45
   46       return valueObject;
   47    })
  • In my copy, I added some more lines of code to get the output in a Google Doc file where I could see that the previous added line actually works:

image

Doing

  • After checking that the unique iD for each object was set correctly and corresponded to the row number in the Wins-form (Responses) file, I wanted to try to use the GitHub API to update the _wins-data.json file in my repository. Just to check that the output in the GitHub repository would be the same as the one in the previous image.

    Problems

  • For some reason that I still can't figure it, whenever I try to make a PUT request, which is part of the process of updating the _wins-data.json file (line 186 of the gh-request App Script ), using my own token and repository, I get a 404 response.

Blockers: No blockers
Availability: 10 hrs
ETA: December 30th

@ExperimentsInHonesty
Copy link
Member

open a new issue, and self assign to Please add the instruction on when and how to encode a token to the contributing.md file

@ExperimentsInHonesty ExperimentsInHonesty removed the 2 weeks inactive An issue that has not been updated by an assignee for two weeks label Dec 26, 2021
@github-actions github-actions bot added the Status: Updated No blockers and update is ready for review label Dec 31, 2021
@SAUMILDHANKAR
Copy link
Member

@lopezpedres Thanks for making a PR. Please add the final code changes that you have made here. Also, the mobile and desktop screenshots of the wins page that you see in your local env after merging PR as well as the unique ID that is generated in wins-data.json file. It will be helpful to get all this documented with this issue. I will add the changes to the main gs code app script and close the PR after your demo on Sunday. Thank you.

@lopezpedres
Copy link
Member

@SAUMILDHANKAR Thank you! I'll attach the two screenshots here:

Mobile Screenshot

screencapture-localhost-4000-wins-2022-01-04-16_12_57

Desktop Screenshot

screencapture-localhost-4000-wins-2022-01-04-16_24_39

Example of an UniqueID generated The key for all the objects is "UniqueID" and its value is the Timestamp when the form was submitted as well as the email of the creator of the submit. Example:
{ "UniqueID" : "2020-11-30T06:17:25.226Z : johnsritchey@yahoo.com"}

@SAUMILDHANKAR
Copy link
Member

// Create an array of objects (key-value pair) based on the column headers and rows of values so the data does not need to be formatted later in GitHub
  const keyValueData = filteredRows.map(row => {
    const valueObject = new Object();
    row.forEach((value, i) => {
      valueObject[columnHeaders[i]] = value;
    })
    const date = valueObject["Timestamp"]
    const formatDate = Utilities.formatDate(date, 'Etc/GMT', 'yyyy-MM-dd\'T\'HH:mm:ss.SSS\'Z\'')
    valueObject["UniqueID"]=`${formatDate} : ${valueObject["Email Address"]}`
    return valueObject;
  })

lines 7, 8, 9 to be added in the main code.

@SAUMILDHANKAR
Copy link
Member

SAUMILDHANKAR commented Mar 2, 2022

  • This issue is almost complete. The final code to be added is in this comment. We couldn't test if the wins page is still functionally the same because of the open issue Google Apps Script: Fix data errors in spreadsheet used for wins page #2901. Ideally, the developer working on this issue should be able to:
  • add the final code in their copy of the Google Apps Script.
  • use a dummy GitHub account to create a PR in their own repo.
  • merge the PR in their own repo and then build the wins page using their own repo and make sure all the functionalities related to the wins page are still the same.

So, last few action items are still pending and therefore, adding dependency and moving this to ice box. Again, thank you Miguel for all your hard work on this. Great work!

@SAUMILDHANKAR SAUMILDHANKAR added the Dependency An issue is blocking the completion or starting of another issue label Mar 2, 2022
@roslynwythe
Copy link
Member

roslynwythe commented Feb 13, 2023

The dependency #2901 has been satisfied, however two new issues should be considered as dependencies: #3722 and #3641

@roslynwythe roslynwythe removed the ready for dev lead Issues that tech leads or merge team members need to follow up on label Feb 13, 2023
@roslynwythe roslynwythe self-assigned this Feb 13, 2023
@github-actions

This comment was marked as outdated.

@roslynwythe roslynwythe added ready for dev lead Issues that tech leads or merge team members need to follow up on and removed ready for dev lead Issues that tech leads or merge team members need to follow up on labels Feb 13, 2023
@roslynwythe roslynwythe removed their assignment Feb 17, 2023
@roslynwythe
Copy link
Member

Added dependencies: #3722 and #3641, as it would be desirable to defer updates to Google Apps Script code until that code is source controlled. Moving the issue to the Ice Box.

@ExperimentsInHonesty ExperimentsInHonesty added ready for dev lead Issues that tech leads or merge team members need to follow up on and removed Dependency An issue is blocking the completion or starting of another issue labels Jan 24, 2024
@ExperimentsInHonesty
Copy link
Member

@roslynwythe I moved this into the new issue review column because the dependency is resolved. Please add a ready for prioritization label if its ready.

@ExperimentsInHonesty ExperimentsInHonesty added Dependency An issue is blocking the completion or starting of another issue and removed Added to dev/pm agenda ready for dev lead Issues that tech leads or merge team members need to follow up on labels Oct 1, 2024
@ExperimentsInHonesty
Copy link
Member

We realized the use case for this is the wins randomizer. When we update our documentation (see depedency) then we will be ready to look at this again.

@roslynwythe roslynwythe self-assigned this Oct 9, 2024
@roslynwythe roslynwythe added the Draft Issue is still in the process of being created label Oct 9, 2024
@HackforLABot
Copy link
Contributor

Hi @roslynwythe, thank you for taking up this issue! Hfla appreciates you :)

Do let fellow developers know about your:-
i. Availability: (When are you available to work on the issue/answer questions other programmers might have about your issue?)
ii. ETA: (When do you expect this issue to be completed?)

You're awesome!

P.S. - You may not take up another issue until this issue gets merged (or closed). Thanks again :)

@roslynwythe roslynwythe removed the Draft Issue is still in the process of being created label Oct 13, 2024
@roslynwythe roslynwythe assigned daras-cu and unassigned roslynwythe Oct 13, 2024
@HackforLABot

This comment was marked as outdated.

@roslynwythe
Copy link
Member

I assigned @daras-cu, a new member of the merge team, because she is interested in becoming familiar with WINS in order to write WINS issues and support other devs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Medium Dependency An issue is blocking the completion or starting of another issue Feature: Google Apps Scripts Automation related to Google Apps Scripts P-Feature: Wins Page https://www.hackforla.org/wins/ role: back end/devOps Tasks for back-end developers size: 2pt Can be done in 7-12 hours
Projects
Development

Successfully merging a pull request may close this issue.