civictechindex / CTI-website-frontend

Join a worldwide movement to catalog 
every open source 
civic tech project.
https://civictechindex.org
MIT License
30 stars 30 forks source link

Test Index Contributor backend script #1048

Closed ladissi closed 3 years ago

ladissi commented 3 years ago

Overview

Test index contributor query code that identified which organizations are index contributors by creating a test repository and organization where we can toggle the civictechindex topic tag. Additionally verify why all results are not showing up in UI.

Action Items

Resources/Instructions

fyliu commented 3 years ago

For the issue of the script yielding more orgs than the website shows, it's because some orgs are not yet marked as approved in the backend django admin.

Here's a screenshot of my local environment where I changed all 13 cti contributor orgs to approved. This is the same number found by the script.

click to expand ![2021-11-11 22 24 14 localhost 0ee9658490f8](https://user-images.githubusercontent.com/1160105/141420593-111c4b38-ef98-4976-83d2-e9ca5298c868.png)
fyliu commented 3 years ago

I have completed testing the script logic. Here are my steps and observations:

  1. Created a test org (with name added) and test repo with topic tag civictechindex
    click to expand

2021-11-11 22 59 13 github com 039c295bcb27

  1. Ran script

Observed: the test org was added by the script

click to expand ``` ==========Script Start========== Creating a set of organizations that have the topic tag -> topic:civictechindex Successfully retrieved the following org -> dict_keys(['OpenOakland', 'Code for PDX', 'Hack for LA', 'Civic Tech Index', 'EnCiv', 'Code for Chapel Hill', 'Code for Tulsa', 'Yale OpenLab', 'Code for Kansas City', '100 Automations', 'BetaNYC', 'Code for Buffalo', "Hack for LA's Sandbox", 'Civic Tech Test Org']) Find civic tech organizations and update their cti_contributor column value Find and Update Complete Add new organizations to database -> {'Civic Tech Test Org': Organization(login="civictechtestorg")} Add new organizations complete ==========Script End============ ```
  1. Approved the test org in the backend
    click to expand

2021-11-11 23 04 14 localhost 4346ac182ee2

Observed: test org was added to the frontend as a cti contributor. 14 total

click to expand ![2021-11-11 23 06 04 localhost e2a38d98586d](https://user-images.githubusercontent.com/1160105/141424881-87d8dc37-a758-4b70-aa6a-e39ca3bc9a6f.png)
  1. Removed the topic tag from the test repo and ran script again
    click to expand

2021-11-11 23 07 16 github com 175e08352cc0

==========Script Start==========
Creating a set of organizations that have the topic tag -> topic:civictechindex
Successfully retrieved the following org -> dict_keys(['OpenOakland', 'Code for PDX', 'Hack for LA', 'Civic Tech Index', 'EnCiv', 'Code for Chapel Hill', 'Code for Tulsa', 'Yale OpenLab', 'Code for Kansas City', '100 Automations', 'BetaNYC', 'Code for Buffalo', "Hack for LA's Sandbox"])
Find civic tech organizations and update their cti_contributor column value
Find and Update Complete
==========Script End============

  1. Refreshed backend admin panel

Observed: the test org was removed from the backend and frontend 13 total Update: the organization was not removed from the database, but only hidden because of the view filter being applied showing only CTI CONTRIBUTORS.

click to expand ![2021-11-11 23 09 59 localhost e1d8d0759234](https://user-images.githubusercontent.com/1160105/141425316-b27f1187-e7cf-4bd7-81e8-671a3fdb10e7.png) ![2021-11-11 23 11 21 localhost ee9ca9254bcb](https://user-images.githubusercontent.com/1160105/141425471-6741472f-3b6c-4c36-acbe-2556ffb5ddd1.png)
fyliu commented 3 years ago

To answer the questions we had during the meeting:

  1. The script updates the CTI Contributor flag for existing organization in the database when projects belonging to organizations add and remove the civictechindex tag.
  2. The script adds an organization with the CTI Contributor flag set to true when it find a new one in the github search that's not already in the database.
  3. Once added, organizations are not removed from the database. Their CTI Contributor flag get updated to false if they remove the civictechindex tag from all their projects.
kevindphan commented 3 years ago

Kevin and Levi will talk about this further in depth.