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

Spike of community resource browsing #980

Merged
merged 16 commits into from
Dec 10, 2021
Merged

Conversation

h-m-m
Copy link
Collaborator

@h-m-m h-m-m commented Jul 3, 2021

Why

This addresses some of #882 and #880. Specifically, it

  • displays community resources in the contributions page
  • allows community resources to be filtered, though only in the contributions page
  • does mark the resources as inexhaustible
  • does not address claiming of community resources

What

This updates our filtering classes so they can handle community resources.
The contact method logic is not implemented correctly, see inline notes below
There are certainly other aspects of this which are incomplete

Screen Shot 2021-07-03 at 11 07 56 AM

How

Testing

Next Steps

Outstanding Questions, Concerns and Other Notes

Accessibility

Security

Meta

Pre-Merge Checklist

  • Security & accessibility have been considered
  • Tests have been added, or an explanation has been given why the features cannot be tested
  • Documentation and comments have been added to the codebase where required
  • Entry added to CHANGELOG.md if appropriate
  • Outstanding questions and concerns have been resolved
  • Any next steps have been turned into Issues or Discussions as appropriate

Howard M. Miller and others added 5 commits July 3, 2021 11:05
there are still a lot of problems with them
The community resources were being filtered out because they don't use service areas the same way as asks and offers. This refactors the scope stuff for filtering by service areas so that it works for community resources as well as asks and offers

Co-authored-by: connieh1 <connie2630a@gmail.com>
@h-m-m h-m-m force-pushed the hmm/spike-of-community-resources branch from 6a55169 to 7ce313f Compare July 5, 2021 14:55
@h-m-m h-m-m force-pushed the hmm/spike-of-community-resources branch from 7ce313f to f888f85 Compare July 5, 2021 14:57
app/models/offer.rb Outdated Show resolved Hide resolved
Comment on lines +59 to +62
# TODO: This is a hack that makes things work for now
# The test creates a contact method that will match this
# and the dev db seeding creates a couple, too
ContactMethod.method_name('call').last
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there some way I can fix this in its own PR? In other codebases I work in, this whole workflow is something I'd hide behind a feature flag so I can get this PR out first, and then get the contact methods for community resources working in a separate PR. I could also try to fix it here, especially if anyone's willing to help me with it. Please let me know

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added an issue for this at #986

@h-m-m h-m-m force-pushed the hmm/spike-of-community-resources branch from a3eb745 to 9c7f9ae Compare July 5, 2021 15:25
@h-m-m h-m-m changed the title Hmm/spike of community resources Spike of community resource browsing Jul 10, 2021
Comment on lines +65 to +75
def type
"Community Resource"
end

def inexhaustible
true
end

def urgency_level_id
UrgencyLevel::TYPES.last.id
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@exbinary mentioned that these don't feel like actual attributes, behaviors, or properties of a community resource, and so they might be better off in an abstraction or interface class that turns community resources into something blueprint-able

Comment on lines +87 to +92
"description" => "Food for the revolution",
"inexhaustible" => true,
"location" => nil,
"match_path" => nil,
"name" => "Free breakfast for School Children Program",
"person" => nil,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@exbinary pointed out how hashes like this to test blobs of JSON are fragile since small changes can then require lots of edits

Howard M. Miller added 3 commits August 14, 2021 12:20
This requires a service area and category for every saved community resource
Cons:
* makes our code less flexible, more brittle because it hardens dependencies between the models
* may frustrate users (but honestly, we don't know without finding some users and asking them)

Pros:
* easy to remove if we change our mind (harder to add later once invalid data already exists)
* very little code to implement and maintain
* requires less rethinking of assumptions for Map and List browser Vue code
Comment on lines +20 to +23
# We're not sure if we need or want these validations. Adding them now assuming it will be easier to remove them later than the other way around
validates :service_areas, presence: true
validates_associated :service_areas
validates :tag_list, presence: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • TODO: fix request specs that now flunk validation checks

@h-m-m h-m-m force-pushed the hmm/spike-of-community-resources branch from d03455d to e898c66 Compare September 18, 2021 15:44
@h-m-m h-m-m marked this pull request as ready for review September 18, 2021 15:59
also destroy relevant join table records when destroying a community resource
@h-m-m h-m-m force-pushed the hmm/spike-of-community-resources branch from e898c66 to cd5aa11 Compare September 18, 2021 16:06
@solebared solebared mentioned this pull request Oct 15, 2021
26 tasks
Copy link
Collaborator

@solebared solebared left a comment

Choose a reason for hiding this comment

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

I think this is good to ship, right @h-m-m ? I know there are caveats that you've documented but otherwise LGTM. Woohoo! 🚀 .

The introduction of community resources to /contributions means that
`.id` is not guaranteed to be unique across all types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants