jhanley634 / dojo-blackboard

An HTMX webserver for the Dojo's Tuesday night python meetups.
MIT License
3 stars 1 forks source link

18 news #19

Closed jhanley634 closed 2 months ago

jhanley634 commented 2 months ago

Summary by Sourcery

Add new features for database maintenance and news headline fetching, enhance request rate limiting, and improve test coverage with new and updated tests.

New Features:

Enhancements:

Tests:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request introduces several changes to improve code organization, add new features, and enhance the existing functionality of the project. The changes include updates to the Makefile, database management, vehicle tracking, ISS position tracking, and the addition of new utility functions and tests.

File-Level Changes

Change Details Files
Update Makefile to improve build and test processes
  • Reorder lint commands
  • Add 'unit' target for running tests with SKIP_SLOW option
  • Update 'test' target to include 'unit'
  • Add 'talk' target for generating PDF from Markdown using Pandoc
  • Update clean target to remove temporary database file
Makefile
Enhance database management with pruning functionality
  • Add prune_ancient_rows function to remove old data
  • Import necessary modules and models
src/bboard/util/database.py
Refactor and optimize vehicle tracking functionality
  • Remove unnecessary print statements
  • Handle potential missing keys in API response
  • Add error suppression for duplicate primary key errors
src/bboard/transit/vehicles.py
Update main application file with new features
  • Add pruning of ancient rows on startup
  • Add favicon endpoint
  • Update root endpoint to use HTMLResponse
src/bboard/main.py
Modify request caching behavior
  • Increase cache lifetime to 6 minutes
  • Update comments to reflect new caching strategy
src/bboard/util/requests.py
Adjust periodic update intervals for transit data
  • Increase delay between updates to 91 seconds
  • Add Caltrain (CT) to the list of agencies
  • Remove separate update for Caltrain
src/bboard/util/lifespan_mgmt.py
Add new tests and update existing ones
  • Add test for repo_top path
  • Mark slow integration tests
  • Add test for no-op function
  • Update vehicle journey storage test to handle IntegrityError
tests/iss_test.py
tests/vehicles_test.py
Modify ISS tracking visualization
  • Use cache busting for ISS API requests
  • Change ISS position marker from 'P' to '+'
src/bboard/transit/iss.py
Add new utility functions and tests
  • Implement cache busting functionality
  • Add tests for cache busting
  • Create utility for marking slow integration tests
  • Add tests for headline fetching
src/bboard/util/cache_buster.py
tests/cache_buster_test.py
src/bboard/util/testing.py
tests/headlines_test.py
Implement news headline fetching
  • Add function to fetch headlines from an API
  • Implement title case correction for news sources
src/bboard/newsfeed/headlines.py
Add new test for database pruning
  • Create test file for database operations
  • Add test for prune_ancient_rows function
tests/database_test.py
Add trip report markdown file
  • Create markdown file with PyBay trip report content
  • Include agenda, five rules, and conference highlights
talks/2024-09-24-trip-report.md

Sequence Diagram

sequenceDiagram
    participant Main
    participant TransitUpdate
    participant VehicleTracking
    participant Database
    Main->>TransitUpdate: Start periodic update
    loop Every 91 seconds
        TransitUpdate->>VehicleTracking: store_vehicle_journeys(agency)
        VehicleTracking->>Database: Store vehicle data
        Database-->>VehicleTracking: Confirm storage
        VehicleTracking-->>TransitUpdate: Update complete
    end
    Main->>Database: prune_ancient_rows()
    Database-->>Main: Pruning complete

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.