Skip to content
This repository has been archived by the owner on Nov 16, 2024. It is now read-only.

Incorporate CRSE and Reddit feedback #20

Closed
eccentricOrange opened this issue May 3, 2022 · 4 comments · Fixed by #21, #22, #23, #24 or #25
Closed

Incorporate CRSE and Reddit feedback #20

eccentricOrange opened this issue May 3, 2022 · 4 comments · Fixed by #21, #22, #23, #24 or #25
Assignees
Labels
CRSE Feedback from the Code Review Stack Exchange enhancement New feature or request

Comments

@eccentricOrange
Copy link
Owner

eccentricOrange commented May 3, 2022

I had posted the code up to commit 6020a4f to the Code Review Stack Exchange (abbreviated CRSE). Good feedback has been received, and will be acted up on.

I had also posted up to commit 3250a1a to r/learnpython on Reddit, and got some good feedback there too.

Each comment tackles one file/aspect of the upgrades. The pull request immedeatly following a comment will have a summary of the changes and decisions made, with respect to the issue comment.

@eccentricOrange eccentricOrange self-assigned this May 3, 2022
@eccentricOrange
Copy link
Owner Author

eccentricOrange commented May 3, 2022

Starting by acting on Database Schema (CRSE Post 3 of 3).

Changes planned based on feedback

  • Attempt to get this to 3NF
  • Implement CHECK constraints where necessary
  • Normalise undelivered_dates.dates
  • Extract the data common to paper_days_costs and paper_days_delivered into a dedicated table.

Other planned changes (such as upgrades)

  • Add proper support for logs

@eccentricOrange eccentricOrange linked a pull request May 3, 2022 that will close this issue
@eccentricOrange
Copy link
Owner Author

eccentricOrange commented May 3, 2022

Starting the changes for the npbc_core.py file (all CRSE posts and r/learnpython).

Changes planned based on feedback

  • Move regex to a different file
  • Replace user input "CSVs" by nargs='+'
  • Remove generate_sql_query() in favour of safe (using ? to substitute instead of f-strings) strings
  • Convert get_number_of_days_per_week() to a yielding generator and rename to something more appropriate
  • Use try-except error-handling
  • Use the a < value < b convention instead of (a < value) and (value < b)
  • Attempt to use yield to format strings
  • Pass a DB connection to functions like get_cost_and_delivery_data ()
  • Stop lying with code like "get the names of all papers that already exist," and use queries that just check for existence instead of returning a value, as per need
  • Use SQLite RETURNING
  • Remove unnecessary DB commits
  • Consider using appdirs (not certain)
  • Consider making NPBC_Updater a dataclass (deferred)
  • Consider extracting DB code into a class
  • Attempt to use docstrings.

Other planned changes (such as upgrades)

  • Add support for all dates string
  • Add support to register an undelivered string for all papers at once
  • Add support for proper logging
  • Allow user to add/edit/delete individual undelivered strings.

@eccentricOrange eccentricOrange linked a pull request May 5, 2022 that will close this issue
@eccentricOrange
Copy link
Owner Author

eccentricOrange commented May 5, 2022

Starting the changes for the npbc_cli.py file (CRSE posts 1-2 and r/learnpython).

Changes based on feedback

  • Remove the behaviour to copy to clipboard by default
  • Use nargs='+' to read undelivered strings
  • Use more (good) error handling
  • Remove unnecessary string escapes
  • Unconditionally print standard output (Colorama stuff)
  • Yield when forming strings (or wherever appropriate)
  • arg_namespace vs ArgNamespace type hint; consider using typing.Annotated
  • Use docstrings.

Other planned changes (such as upgrades)

  • Add support to register an undelivered string for all papers at once
  • Allow better user queries
  • Allow user to add/edit/delete individual undelivered strings.

@eccentricOrange eccentricOrange linked a pull request May 8, 2022 that will close this issue
@eccentricOrange
Copy link
Owner Author

eccentricOrange commented May 8, 2022

CI/CD is creating trouble, since introducing RETURNING in SQL code.

See the workflow runs for 5c529da.

E sqlite3.OperationalError: near "RETURNING": syntax error


It's possible that this is due to an old version of SQLite. Will attempt to resolve using Docker.

This was linked to pull requests May 9, 2022
@eccentricOrange eccentricOrange added enhancement New feature or request CRSE Feedback from the Code Review Stack Exchange labels Jun 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.