Skip to content

Refactored JavaScript files so that Events page sources meeting data from vrms_data.json#6815

Merged
roslynwythe merged 9 commits intohackforla:gh-pagesfrom
irais-valenzuela:refactor-js-events-page-6023
May 8, 2024
Merged

Refactored JavaScript files so that Events page sources meeting data from vrms_data.json#6815
roslynwythe merged 9 commits intohackforla:gh-pagesfrom
irais-valenzuela:refactor-js-events-page-6023

Conversation

@irais-valenzuela
Copy link
Member

Fixes #6023

What changes did you make?

  • Created a new file in assets/js/utility called vrms-events.js to handle data fetching from the vrms_data.json file, vrms data sorting, and vrms data formatting for both project.html and right-col-content.html page.
  • The project.js file no longer has sorting and time formatting functions sortByDate and timeFormat as they were moved to vrms-events.js file and timeFormat was replaced with localeTimeIn12Format. Project.js still uses sortByDate and formatting functions but they're are now coming from vrms-events.js.
  • The right-col-content.js file now has the insertEventSchedule functionality that used to live in api-events.js. As well as other functions that used to be in api-events.js.
  • Api-events.js is no longer being used for right-col-content.js to grab event data so most of that file is commented out.
  • In summary, both project.html and right-col-content.html now share data fetching, sorting, and formatting functionality.

Why did you make the changes (we will use this info to test)?

  • Needed to reduce the latency and improve the reliability of the Events page and leverage the vrms_data.json file that already had event data to render meeting times for events page.
  • Both project.html and right-col-content.html had data fetching, sorting, and formatting logic that could be shared by both files.

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

Visuals before changes are applied No changes to website.
Visuals after changes are applied No changes to website.

@github-actions
Copy link

github-actions bot commented May 4, 2024

Want to review this pull request? Take a look at this documentation for a step by step guide!


From your project repository, check out a new branch and test the changes.

git checkout -b irais-valenzuela-refactor-js-events-page-6023 gh-pages
git pull https://github.com/irais-valenzuela/website.git refactor-js-events-page-6023

@github-actions github-actions bot added role: front end Tasks for front end developers Complexity: Large P-Feature: Events https://www.hackforla.org/events/ size: 2pt Can be done in 7-12 hours labels May 4, 2024
---
---

{% assign vrmsData = site.data.external.vrms_data %}

Check notice

Code scanning / CodeQL

Syntax error

Error: Unexpected token
* @return {String} - The name of the day represented by the time string. Example 2020-05-13 was a wednesday. I.e rv = 'Wednesday'
*/
function getDayString(date) {
let new_date = new Date(date);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class

Unused variable weekday.
@aadilahmed aadilahmed self-requested a review May 5, 2024 05:19
@aadilahmed
Copy link
Member

Review ETA: EOD 5/7/24
Availability: 9-5 PM M-F

Copy link
Member

@aadilahmed aadilahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @irais-valenzuela , great job so far, the meeting data on the "events" page matches the live site exactly.

However, the meeting data is blank on the "events-check" page, which I believe is because you commented out the code in api-events.js . To maintain the behavior of the original events page, you should revert api-events.js back to its original code.

@irais-valenzuela
Copy link
Member Author

@aadilahmed Thanks for catching that! I just restored the code. Let me know if everything else is good.

Copy link
Member

@aadilahmed aadilahmed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works as expected, great job @irais-valenzuela !

Copy link
Member

@roslynwythe roslynwythe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @irais-valenzuela on this Complexity: Large issue!

  • Code changes are clean, correct and achieve the desired refactoring
  • Pull Request is well-formed with proper branching and description of work
    • The description could be improved slightly by replacing both of the "Visual changes" detail-summary blocks with a single line "no visual changes"
  • Local testing of /events-check shows that event list is consistent with the live /events page
  • Local testing of /projects/civic-tech-jobs shows that event list is consistent with the live /projects/civic-tech-jobs page
  • Local testing of /events shows that event list is consistent with the live /projects/civic-tech-jobs page

Unfortunately in the process of checking events, I discovered discrepancies between the events on pages sourcing data from the API calls versus pages sourcing data from the vrms-data.json file,

  • Those will be addressed in #6838

Thank you @irais-valenzuela for this contribution to Hack for LA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complexity: Large P-Feature: Events https://www.hackforla.org/events/ role: front end Tasks for front end developers size: 2pt Can be done in 7-12 hours

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor JavaScript so that Events page sources meeting data from vrms_data.json

3 participants