coderxio / dailymed-api

REST API for DailyMed SPLs
https://coderx.io/
MIT License
12 stars 5 forks source link

Jrlegrand/30/filters #35

Closed jrlegrand closed 4 years ago

jrlegrand commented 4 years ago

Fixes coderxio/dailymed-api#30, fixes coderxio/dailymed-api#34

Explanation

Added Django Filters functionality for SPL view and made the SPL view distinct by adding distinct=True to the individual filter elements. Also made schedule a multiple select and added SCHEDULE_OPTIONS.

Rationale

So users can filter down to only the SPLs they care about. Alternatives considered were using GraphQL-type functionality, which we may implement later on.

Tests

  1. Tested out different filters and discovered a duplication bug which was also fixed as part of this PR
finish06 commented 4 years ago

@jrlegrand Would you like to fix the styling errors or would you like me to do it?

0.53s$ flake8
./api/dailymed/filters.py:4:1: E302 expected 2 blank lines, found 1
./api/dailymed/filters.py:7:80: E501 line too long (100 > 79 characters)
./api/dailymed/filters.py:8:80: E501 line too long (90 > 79 characters)
./api/dailymed/filters.py:9:80: E501 line too long (91 > 79 characters)
./api/dailymed/filters.py:10:80: E501 line too long (125 > 79 characters)
./api/dailymed/filters.py:11:80: E501 line too long (125 > 79 characters)
./api/dailymed/filters.py:12:80: E501 line too long (88 > 79 characters)
./api/dailymed/views.py:11:1: E302 expected 2 blank lines, found 1
jrlegrand commented 4 years ago

I'll give it a shot tomorrow morning.

finish06 commented 4 years ago

@jrlegrand Two pending styling errors:

$ flake8
./api/dailymed/filters.py:13:1: E302 expected 2 blank lines, found 1
./api/dailymed/filters.py:27:37: W291 trailing whitespace