magfest-archive / guests

Magfest band management plugin for ubersystem
GNU Affero General Public License v3.0
1 stars 1 forks source link

Fixes #93: Adds Rock Island merch info collection #108

Closed RobRuana closed 7 years ago

RobRuana commented 7 years ago

Fixes #93.

This is a big pull request. It may be easiest to review by actually running the code locally.

kitsuta commented 7 years ago

It seems as though this has some bugs? I tried adding an item to a band's inventory for rock island and got this:

Unrecoverable error in the server.Traceback (most recent call last): File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 670, in respond response.body = self.handler() File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/lib/encoding.py", line 221, in call self.body = self.oldhandler(*args, kwargs) File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cpdispatch.py", line 60, in call return self.callable(*self.args, *self.kwargs) File "/home/vagrant/uber/sideboard/plugins/uber/uber/decorators.py", line 252, in with_timing return func(args, kwargs) File "/home/vagrant/uber/sideboard/plugins/uber/uber/decorators.py", line 267, in with_session retval = func(*args, session=session, kwargs) File "/home/vagrant/uber/sideboard/plugins/uber/uber/decorators.py", line 388, in with_restrictions return func(*args, *kwargs) File "/home/vagrant/uber/sideboard/plugins/uber/uber/decorators.py", line 328, in with_rendering result = func(args, kwargs) File "/home/vagrant/uber/sideboard/plugins/uber/uber/decorators.py", line 106, in returns_json return json.dumps(func(*args, kwargs), cls=serializer).encode('utf-8') File "/home/vagrant/uber/sideboard/plugins/guests/guests/site_sections/guests.py", line 188, in save_inventory_item guest_merch.update_inventory(inventory) File "/home/vagrant/uber/sideboard/plugins/guests/guests/models.py", line 454, in update_inventory self._save_inventory_files(inventory) File "/home/vagrant/uber/sideboard/plugins/guests/guests/models.py", line 357, in _save_inventory_files with open(self.inventory_path(item[filename_attr]), 'wb') as f:FileNotFoundError: [Errno 2] No such file or directory: '/home/vagrant/uber/sideboard/plugins/guests/uploaded_files/inventory/cd9cd1d4-4be7-4354-aa86-86f6ee87922e'During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 589, in run self.respond(pi) File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 690, in respond self.handle_error() File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 765, in handle_error self.hooks.run('before_error_response') File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 114, in run raise exc File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 104, in run hook() File "/home/vagrant/uber/sideboard/env/lib/python3.4/site-packages/cherrypy/_cprequest.py", line 63, in call return self.callback(self.kwargs) File "/home/vagrant/uber/sideboard/plugins/uber/uber/server.py", line 27, in log_exception_with_verbose_context p = [" %s: %s" % (k, v[:max_reporting_length]) for k, v in cherrypy.request.params.items()] File "/home/vagrant/uber/sideboard/plugins/uber/uber/server.py", line 27, in p = [" %s: %s" % (k, v[:max_reporting_length]) for k, v in cherrypy.request.params.items()]TypeError: 'Part' object is not subscriptable

The error seems to be the same for any category of item.

kitsuta commented 7 years ago

There's also a couple minor errors:

  1. As noted in Slack, the 'add an item' dropdown is output twice on the page (Mac OS X, Chrome): image

  2. The "Anything else?" textarea form has the same help text as "How many boxes are you bringing?" image

RobRuana commented 7 years ago

I've pushed fixes for the two issues: removed second drop-down, and removed extraneous help block.

As for the file save error, @kitsuta, I have not been able to reproduce it. I hope it's not a windows/vagrant filesystem error. Can you verify a few things for me?

  1. Does the inventory directory exist on your vagrant box with the correct permissions?
    (env) vagrant@localhost:~$ ls -la uber/sideboard/plugins/guests/uploaded_files/
    total 0
    drwxr-xr-x 1 vagrant vagrant 204 Sep 23 20:01 .
    drwxr-xr-x 1 vagrant vagrant 714 Sep 30 12:56 ..
    drwxr-xr-x 1 vagrant vagrant 170 Sep 23 17:28 bio_pics
    drwxr-xr-x 1 vagrant vagrant 408 Sep 30 13:01 inventory
    drwxr-xr-x 1 vagrant vagrant 136 Sep 22 12:49 stage_plots
    drwxr-xr-x 1 vagrant vagrant 204 Sep 22 14:02 w9_forms
  2. Can you upload other guests related files? For example, can you upload a band's bio pic on this page: https://localhost:4443/uber/guests/bio?guest_id=XXX
kitsuta commented 7 years ago

The error is indeed to do with a missing inventory directory. Creating one by hand solves the error, but I guess it's missing from this branch? 😅

If I delete, e.g, the bio_pics directory, I get a similar/the same error. So, note to self, don't delete any of those directories! :O

RobRuana commented 7 years ago

I think laziness on my part sums up this whole pull request!

RobRuana commented 7 years ago

Depends on https://github.com/magfest/ubersystem/pull/2878

RobRuana commented 7 years ago

Okay! Added the stuff that I was too lazy to do the first time around!

This still depends on https://github.com/magfest/ubersystem/pull/2882, so you may want to take a look at that pull request also.