Process: Create new classical NRP for the Vedun project starting 2018-03-14 ending 2018-03-31

If you were logged in and working on this process, you would log your work on this page.

Outputs

Scheduled:

OVNi module 1.00 Idea due March 31, 2018

Work

Planned Work: (Requirements are ordered by due date)

Prototype software: 1.00 Idea due March 14, 2018
Unassigned
Work - Facilitation and coordination: 1.00 Time - Hours due March 14, 2018
Unassigned
Work events:
July 18, 2018 0.02 Time - Hours Done by Tibi

test

March 30, 2018 1.22 Time - Hours Done by davidh

Fixed the checks problem by rolling back the django-cors-headers library to 1.1.0
Now the problem appears to be that django cannot find the corsheaders library; it appears to install at a funny location, ~/lib/python2.7/home/lib/python2.7/
Uninstalling all dependencies and starting a fresh virtualenv

Still can't find corsheaders.
Moving it to a normal location manually

Now it can't find south. looks like it installed into lib/python3.6. May have to roll it back; if the current version wants python3.6 it just isn't going to play along.
That worked.

Now it is missing a setting for AUTH_USER_MODEL. It looks like this can be used to override the default user model in django, but I have no idea whether this was done or not in the NRP.
It appears that the original settings.py does not set AUTH_USER_MODEL either; will look down the stack trace to see if a library messed this up, then roll it back further.
Nope, this is directly in django. I'll have to take a wild guess at what this should be.
Looks like it's a really bad idea to make a wild guess based on the django docs. Grovelling at Bob for info.

March 30, 2018 4.15 Time - Hours Done by davidh

Verified that django 1.4 has no checks module, which means one of these libraries thinks it has a newer django. Will need to roll back something to a previous version.
Yep, django-extensions library versions 1.7+ requires django 1.8+. This has to be rolled back, at minimum. Setting requirements.txt to use 1.6.7 for now.
django-webtest versions 1.9+ require django > 1.7. Setting in requirements.txt to 1.8.0
django-notifications versions >0.8 require django > 1.6. Setting in requirements.txt to 0.8.0
django-cors-headers current version is not tested with 1.4 but supports versions above and below it. Let's see if the other rollbacks work.
apparently django-notifications doesn't come in 0.8 anymore. Most recent < 0.8 is 0.2.0.
still running into error looking for checks, so something is clearly still incompatible
manage.py syncdb problem was (mostly) solved, but there's an extensions package missing from the backend adapter.
fetched a fresh copy of that, no more problem there. Now manage.py syncdb fails due to missing checks again.
brute force searched for core.checks on entire library directory, no dice, so while these would all have become issues eventually, there's something else causing this.
Now it must be related to the old version of django that was on there before.

Brief break for research.

Checking out environment variables that could affect the libraries accessed. No dice. As it stands, I don't have access to some of the folders on the current python path, it's possible that something else is interfering with django there.

March 29, 2018 2.32 Time - Hours Done by davidh

Working out how to get this running without sudo
Need to roll back python to 2.7 or earlier, otherwise django can't use except ImportError, e
Adding missing __init__.py to github repo and pulling to server
Django is missing django.core.checks, possibly due to version clash; webfaction doesn't ship django 1.4 anymore, but the NRP specifically requires it. I installed 1.4, but either the installation was unsuccessful (verified that there is no core/checks in lib/python2.7/django/) or there's something still pointing at the old django

March 27, 2018 1.37 Time - Hours Done by davidh

Setting up server to run the project
got it to the point where I could follow the proto-manual, but couldn't continue because "valnet is not on the sudoers list" i.e. can't sudo apt-get etc.

Work - Infrastructure - OVNi module development: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Writing: 1.00 Time - Hours due March 14, 2018
Unassigned
Work events:
March 17, 2018 0.53 Time - Hours Done by davidh

Adding a few ideas about how to reduce the model jargon in the UI to the Legacy NRP Revision Plan

March 14, 2018 1.50 Time - Hours Done by davidh

Wrote initial commit of the document "Legacy NRP Revision Roadmap"

Work - Information mining: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Design Software - Game: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Training self: 1.00 Time - Hours due March 14, 2018
Unassigned
Work events:
March 25, 2018 0.30 Time - Hours Done by davidh

Looking at Django and Bootstrap docs to see if there's any way around manually binding instance data if it has multiple representations in a single page.

March 21, 2018 0.47 Time - Hours Done by davidh

Reading Bob's in-depth explanation of value equations and their implementation in the NRP

March 20, 2018 1.60 Time - Hours Done by davidh

Investigating the HTML, CSS, and JavaScript present in the old NRP to determine how best to modify them to make them more mobile-friendly
Found that the HTML is relying on locally served JavaScript that is missing from the repo; it is a minified version of the Bootstrap library, which must go into /static/js/bootstrap/js/bootstrap.js. The version of the library is unknown, but without including it in the repo the site will crash and burn.

March 20, 2018 0.00 Time - Hours Done by davidh
March 17, 2018 2.58 Time - Hours Done by davidh

Investigating Transfer Type relationship to Exchange Type, Resource Type, Transfer Facet Value in detail
Preparing to fill fields and filter lists in various Exchange, Commitment, and Transfer views
Exhaustively catalogued all the fields available through the Exchange logging view, listing types and relationships to Transfer Types

March 16, 2018 1.15 Time - Hours Done by davidh

for issue: Transfer Types should be able to configure more defaults... #495
Gathering information on transfer types, exchange types, use cases, and facets to determine what the default values should be

March 15, 2018 0.38 Time - Hours Done by davidh

Researching original models.py details to determine the best approach to testing issue #511, specifically how to break the function Transfer.event_text

Work - Programming for product: 1.00 Time - Hours due March 14, 2018
Unassigned
Work events:
May 22, 2018 1.62 Time - Hours Done by davidh

Checking out the create order UI. Looks pretty good; might want to make the description row-fluid to get it to sit to the right on monitors and go under the thumbnail on mobile. Also, I thought I had the controls to the right of the thumbnail, which would make the description on the bottom make more sense. Looking into that. The template overrides the extra_head block without adding the block.super, so I stuck that in. Probably should consider this first if there are any other silly looking things in the HTML. Perfect.

Now for the finale, testing the value equations UI. Made a roughly fair value equation that rewards squeezing work. I'm now double-billing for coding and squeezing lemons (for the lemonade stand test project). Have to make a juicer to complete the process, can't find the control to adjust the quantity. So I went to add an unplanned output to the process as a quick hack, but I found that the dialog has a lot of goofy text that doesn't really belong anywhere. Investigating. Went ahead and added block.super since it was missing. The type variable wasn't declared, which really should have caused it to crash, but didn't. Should work now.

The resource type dropdown list options are not quite right; may be due to the missing label fields. Should be easier to fix at the tag level, otherwise will need to sweep all the templates. Alternatively, it might be due to a missing process pattern or a lack of output resource types (though I don't see how they would get messed up in this way). It actually looks as if it's the string-ification of resource types adding a list of facet values, since two forms that have nothing at all else in common are having the same problem. Er, it looks like the facets were included intentionally. Anyway, the labels are fixed.

Looks like everything works to me. Calling it a day on this one, switching over to brainstorming on the next-gen NRP standardization minimal requirements.

May 21, 2018 1.42 Time - Hours Done by davidh

Investigating the 2 remaining create_order test fails. In both cases, the offending commitment list is from changeable.producing_commitments(), which should have two elements, but instead has none. Indeed, the list of commitments makes no mention of changeable. Will have to examine the test system to make sure there really should be changeables involved, as I only see the order for parent, child, or grandchild, and my impression was that those are related only to each other.
Sure enough, there are no solid links between those 2 systems that I can find, so I don't know how this was supposed to happen.
Changed them to order the workflow recipe RTs, and everything now works. Confetti please.

And now the server is handing out 500 internal server errors. Will have to check out log files. Yeah that one is going to be webfaction's problem, unfortunately.

May 20, 2018 3.80 Time - Hours Done by davidh

Messing with the test_orders.py; the field names have changed, the primary keys have changed, and the tests relied on all of that. Luckily I did figure out what the old primary keys were.
Er, can't import django.forms.BaseFormSet? I'm looking at the source right now.....
Can't import it. Interesting. aha, it's django.forms.formsets.BaseFormSet

If this doesn't work I need to create an OrderItem model class to bind to the form class; they could be confused that they aren't really associated with real live commitments in an exact way.

Needs a max_items to survive, eh? Added all the static fields I could see the Django code doing to its own formsets.

Looks like the #510 fix test passes, but I've spoken too soon about that before.
Drat. The RT IDs are still not appearing.
Just for fun, try getting rid of the boundness to Commitment, which I don't like at all anyway. Maybe it will validate anyway.
That worked. I need to stop trusting the Django documentation.

Came up with a hackish, inelegant fix that works for the IDs, plugged default values of zero in literally every place conceivable for the quantities, since they went unfilled in the initializers. Seems to make the forms' is_valid work, finally. Now, to deal with the 2 remaining failing tests (yeah we're down two!)

May 18, 2018 5.22 Time - Hours Done by davidh

About to get a smoking gun in relation to VerdunNRP #10 and valnet #510. It's the order item form. It can't find its fields right. Or maybe my list comprehension sucked. Both of these things are true.
Probably going to need to rewrite the form class as an order form with an order item form formset. Otherwise I'm just not equipped to figure out what is confusing the form bindings.

The plan is like this. I wanted to mess with the order form anyway, get rid of the table, make it look more like the inventory list, make things a little more sensible with regard to the fact that it isn't bound to a commitment object anyway, it doesn't use half of its fields now, etc. etc. I can clean it up so that it uses an independent template. Done with that template, _order_item_rt.html
Now for the parent template, create_order.html
Done (it has some TODOs for filtering, but I doubt it will come up)
Made some changes to forms.OrderItemForm, made forms.OrderItemFormSet to manage them
Modified the view to accommodate.
Won't have time to test it, so I leave it down for today.

May 17, 2018 0.92 Time - Hours Done by davidh

Apparently there was a problem saving the notes from my last debug session, so the last line should have read:
The fail-early scenario (implemented in views.create_order) was the one that played out, so the form classes are a good place to start. E.g. which of the form validators flunked, or was it the additional stipulation that there needed to be at least one non-zero order item?

In all 3 cases, the receiver was being problematic; it doesn't have a default even when the list is populated. Added defaults & disambiguated problems with error types and messages. That problem is fixed.

New issue: commit referenced before assignment, which I believe was the original issue in the valnet version. Have an appointment, will fix when I get back.

May 17, 2018 6.55 Time - Hours Done by davidh

Returning to issue of commit being unassigned when referenced in views.create_order.
Also making said function a little more logical about its choice of default users, and reviewing best practices on raising ValidationErrors

I feel a little dumber about this, but it appears we can circumvent this problem entirely by getting the date from the order creation date (or just datetime.date.today). Using the method that creates these commitments in the first place, there is no way for these commitments to have any other date. However, it's still probably going to fail all the tests, as there is no good reason for commit to be None unless there are no commitments in the DB for the order, unless they failed to be generated. But the tests and the extra diagnostic functions should catch this when the the view function doesn't throw in these locations.

Er, now it's having the receiver issue too... how did that go away temporarily? Maybe it wants the ids? Nah, that was pretty dumb too. Fixed.

Diagnostic shows association flaw in all 3 cases; elaborating that trap. Fix for #510 shows 1 commitment existing after a zero quantity order.
Just to make sure, adding assertion that all commitments are really gone under fix #510.
All 3 of the other tests are showing flaws at the first call, which in all cases is using resource_type.producing_commitments(), so let's start there.

Things that are not the problem with the 3 association issues:
- No commitments generated at all (there is 1)
- Parent RT not associated with (the 1) commitment
- Commitments not associated with event types
- Parent RT not associated with producing process
- Commitment associated with RT not associated with order (the 1 is)

I might have just cracked it, but it will be a pain to really fix. However, if I am right, it should address all 4 problems. The OrderItemForms are not binding to their own controls. That explains why it wouldn't catch the quantity issue, but would stop the items from ever being added to the order. Testing just that hypothesis for now before I make huge changes to fix it. Yeah that has gotta be it. Will start patching it up tomorrow.

May 16, 2018 3.83 Time - Hours Done by davidh

Continuing debugging of customer orders and tests thereof.
Adding various prints to narrow down where exactly the resource types go awry.

Typical Output:
recipe created parent RT parent : 87
recipe created child RT child : 88
recipe created grandchild RT grandchild : 89
order_test.setUp sees parent RT parent : 87
order_test.setUp sees child RT child : 88
order_test.setUp sees grandchild RT grandchild : 89
view got RT another changeable : 91; made fields {'quantity': <django.forms.fields.DecimalField object at 0x4623710>, 'description': <django.forms.fields.CharField object at 0x46239d0>, 'resource_type_id': <django.forms.fields.CharField object at 0x4623210>, 'url': <django.forms.fields.URLField object at 0x4623150>}
view got RT changeable : 90; made fields {'quantity': <django.forms.fields.DecimalField object at 0x4623e10>, 'description': <django.forms.fields.CharField object at 0x46230d0>, 'resource_type_id': <django.forms.fields.CharField object at 0x46231d0>, 'url': <django.forms.fields.URLField object at 0x4623610>}
view got RT parent : 87; made fields {'quantity': <django.forms.fields.DecimalField object at 0x4623b90>, 'description': <django.forms.fields.CharField object at 0x4623ed0>, 'resource_type_id': <django.forms.fields.CharField object at 0x4623f50>, 'url': <django.forms.fields.URLField object at 0x4628110>}
Uh huh... two problems are very apparent. First, two unrelated RTs (changeable & another changeable) have made it into the form, Second, the child & grandchild RTs did not make it into the form.

My impression was that there were no RTs at all in the DB at this point, but evidently tests.objects_for_testing.WorkFlowRecipe makes changeable and another changeable. Ultimately this won't be a problem if I can get the right RTs to show up too.

View filters RTs by:
PatternUseCase.objects.get(use_case__identifer="cust_order").pattern.all_resource_types()
or equivalent. Or, not quite equivalent; they use objects.filter(...)[0]...
If there are multiple objects returned that will surely not work. Nope, wasn't that.

Aha. The child and grandchild RTs were lacking resource type facet values that make them appear in the customer order process type.
That did the trick. Prepare confetti. Just need to chop off these response.follow() calls. Put back the confetti.

Tests output:
======================================================================
ERROR: test_create_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order view
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 181, in test_create_order
process = self.parent.producing_commitments()[0].process
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/db/models/query.py", line 207, in __getitem__
return list(qs)[0]
IndexError: list index out of range

======================================================================
FAIL: test_create_workflow_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order for a workflow item
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 243, in test_create_workflow_order
self.assertEqual(count, 2)
AssertionError: 0 != 2

======================================================================
FAIL: test_two_workflow_item_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order for two workflow items
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 283, in test_two_workflow_item_order
self.assertEqual(count, 2)
AssertionError: 0 != 2

Alright obviously in the first case, self.parent.producing_commitments() is empty. That method filters commitments with RT==self whose event_type.relationship=="out" or whose event_type.name=="Receipt". Event types are set up in fixtures, but they do generate one in the test setUp(). Looks like all 3 fails are actually due to this empty query set, but only the first crashes. So it could be either failure to produce these commitments in views.create_order, or failure of commitments to associate to the right event types, processes, process types, patterns, etc etc.

Put together several fault-finding mechanisms to determine whether the test, the association setup, or the actual code is broken. Discovered that the fail-early scenario is playing out; will need to see what I did to validation tomorrow.

May 15, 2018 3.60 Time - Hours Done by davidh

Setting up some of the entities used by the orders tests as fixtures rather than creating them programmatically during the test in an attempt to remedy the issue of mismatched primary keys
Putting that on hold, it's going to take a lot of work to adapt that into the test code without going back to primary keys.
Trying another mapping of the hard-coded PKs based on the original creation order (not that I can figure out why there would be 3 RTs produced right in a row with PKs 6, 9, and 10)
Now for exchange_type getting erased. Sure enough, neither fixtures nor the objects_for_testing.py create any ExchangeType objects, so the form would be unable to choose a default the way it does when served.
Adding sale as an ExchangeType fixture and TransferType fixtures in hacks/fixtures.js and fixtures/verdun.json. Also adding a few bits to fixtures.js to let me add a few extra properties to instances so that the resulting objects have the bells and whistles like a description.
Adding the new functionality to the documentation for hacks/fixtures.js to hacks/readme.md
Implementing use of the exchange type in the tests. I can tell this is probably going to crash down the line anyway, as there are a bunch of array indexes, but this should get it past the immediate crashes if the new mapping of RT keys is correct.
Now they crash because ExchangeType model has no all... uh huh... oops. It should be objects.
Now it needs to have the id/pk of the exchange type. Needs a get() too
Looks like it will need to have the form's receiver filled out too. Maybe it will take the user they've already set up?
It will not, but there are two options in that select box.

May 14, 2018 2.18 Time - Hours Done by davidh

Starting work on issue: Create Order dies #10
Just to see what happens, getting rid of the offending import.
No issues calling up the page itself.
Re-enabling tests.
Tests fail because of all the hard-coded primary keys in the tests, though I do recall them resisting attempts to force it into accepting more reasonable forms of data because of oddly incoherent primary key assignments.
The validation test also throws missing the exchange_type key from the QueryDict. Form class has exchange_type. HTML has exchange_type.
Using pdb trace, discovered that exchange_type is trimmed from the dictionary by WebTest's submit(), which calls fields = self.submit_fields().
submit_fields() trims off any field with a None value. This doesn't seem to bother the actual form served to the UI.
Breaking for lunch

May 11, 2018 2.32 Time - Hours Done by davidh

Trying Bob's solution for issue: AttributeError at /accounting/exchanges/ #20
Also making sure there isn't a type issue at the root of the problem, since the lack of union() method on a QuerySet doesn't really make sense.
Set objects don't have a distinct() method, so if I do that, I will have to get rid of those calls.
Did that, also had to convert a related object manager to a QuerySet with all()

Investigating issue: accounting/resource/ can't display units of quantity or use #19
view function in views.py sets the context's resource variable to an EconomicResource instance
EconomicResource class has resource_type as an instance of EconomicResourceType, meaning it probably gets string'd somewhere in the template?
Oops. The unit_of_quantity is a getter in EconomicResource, not the resource type
Still not showing up. Made the field obligatory and used formatted_quantity to let python figure out what unit to use.
The unit_of_use not appearing may be due to a lack of value_per_unit_of_use, rather than unit_of_use. Yeah, that should work once those are assigned.
Now it works. The unit's symbol property needed to be erased to get the unit positioned right.

Inventory page has same aesthetic issues as resource types did. Fixing that. Works and looks good.

May 4, 2018 5.62 Time - Hours Done by davidh

Starting work on issue: Inventory/Resource Types page is ugly. #16
Added some mostly logical divs, floated and hanged image, set "view recipe" on its own line right of the image.
Oops, left a div unclosed.
Explicitly set the div containing the image to block vertically and fit its content height (the CSS for this property may not be supported everywhere, should look into it)
A similar effect can be achieved by setting height: 100%, maybe try that first since it's universally available.
None of that worked. Using clearfix. Worked.

Attempting to support the test project and test exchange functionality by adding exchanges of the new exchange types.
Noted additional problem for issue: Forms using chair_tag.py are ugly #12

Couldn't use the purchase exchange type to add a juicer, so I went to add it via Inventory > Resource Types > Juicer > Create Resource
Found issue: Formsets rendered as .as_ul without labels are ugly #17
Put labels on ul and li elements to prevent the ugliness.
Might want to grep something here, perhaps .as_ul, since the pattern was used for that initially.
Grep output on templates/valueaccounting:
_form_dialog.html (fixed already)
log_past_work.html
log_simple.html
process_oriented_logging.html
resource.html
resource_type.html (fixed already)
workbook.html
Fixed all of those by adding <b>Plural description</b> to main ul and description #{{forloop.counter}} to inner li
Also prepared the chair_tag.py |s filter to handle strings marked for translation.

While checking out resource.html, found issue: TemplateSyntaxError at /accounting/resource/ #18
Obviously another nested variable syntax problem
Oops! that should have a field argument too.
Somehow the resource.resource_type is getting cast to string, preventing the template from getting to its unit_of_use, unit_of_quantity, etc. Will address separately since the syntax error itself is fixed..
Created issue: accounting/resource/ can't display units of quantity or use #19

Checking out process oriented logging, started a new process to access. Found that it was impossible to access the #createResourceForm I modified because its only a[data-toggle] is commented out. It's embedded in another modal, so that wasn't going to work anyway. Another modal is conditionally rendered to the modal, but the button (add output) is rendered regardless. Fixed that by making the button have the same condition as the form. Log unplanned output (the other modal that was modified) didn't appear to use the new list styles I added to site_base; turns out it overloads the extra_head block, so I added block.super. Didn't take, so I commented out the li CSS in the document.
That works.

Typo on log_past_work, fixed.

log_simple seems to be inaccessible from any view, skipping.

Facets are resisting outputting all of their fields using .as_ul, will fix tomorrow.

May 3, 2018 0.00 Time - Hours Done by davidh
May 3, 2018 4.65 Time - Hours Done by davidh

Attempting to add exchange types myself, marking everything I create with TEST so that it's visible from the admin interface.
Copying the exchanges, process patterns, transfer types from the existing Sensorica NRP.

Exchange Type: Donation TEST
Process Pattern: Donation process pattern TEST
Transfer Type: Donation

No clear answer for which Use Cases the patterns should have, leaving that blank for now; unfortunately I think this is sort of vital to some algorithms, so at some point this is still going to be a show stopper for tests. Transfer types on the other hand seem to be complete.

Exchange Type: Expense TEST
Transfer Types: Expense, Pay Expense
Process Patterns: Expense TEST, Pay Expense TEST

Exchange Type: Material Contribution TEST
Transfer Type: Resource Contribution

Exchange Type: Purchase TEST
Transfer Type: Receipt, Additional Expenses, Pay Purchase
Process Patterns: Purchase Receipt TEST, Purchase Addl Expense TEST, Purchase Pay Purchase TEST

Exchange Type: 3D Printer Use TEST
Transfer Types: Paid Service Package, Maintenance Fee
Process Patterns: 3D Printer Maint Fee TEST, 3D Printer Svc Pkg TEST

Exchange Type: Maintenance Fee TEST (does not appear to be used in the Sensorica NRP)
Transfer Types: Use of Sensorica Resources, Pay Maintenance
Process Patterns: Maint Fee Resource Use TEST, Maint Fee Pay TEST

Exchange Type: FabLab Membership TEST (also appears unused)
Transfer Types: Monthly FabLab Membership, Membership Fee
Process Patterns: FabLab Membership TEST, FabLab Membership Fee TEST

Exchange Type: Fiscal Sponsorship TEST
Transfer Types: Deliverable, Sponsorship
Process Patterns: Fiscal Sponsorship (not created, but modified to include For Sale: For Sale facet value)

Exchange Type: Loan Repayment TEST (appears unused)
Transfer Type: Pay Back Loan
Process Pattern: Loan Repayment TEST

Exchange Type: Rent TEST (appears unused)
Transfer Types: Rent, Rent Payment
Process Pattern: Rent TEST

Exchange Type: Sale TEST
Transfer Types: Shipment, Cash Receipt

Exchange Type: Tech Shop Access TEST (appears unused)
Transfer Types: Use of Lab, Tech Shop Payment, No Cleanup Fee
Agent Association Type: TechShop User TEST
Process Pattern: Tech Shop Access TEST

Returning to UI & HTML tests.

Found Issue: AttributeError at /accounting/exchanges/ #14
That's really silly behavior; empty query sets can't union. Luckily, they do bool as False. so I can fix with conditional expressions. Made a dry throw-proof union().
Now I get 'Exchange' object has no attribute 'own_events_list' at views.py line 10279:x.event_list = union(x.transfer_event_list, x.own_events_list).distinct()
should be x.own_event_list (no s)

Found issue: Various cosmetic issues with accounting/change-exchange-type/ #15
The lack of spaces at those points is clearly due to using |add instead of |sp or manual spaces. Easy fix.
The Proxy issue requires that the translation string is unicode()ed.
The purely cosmetic issues are fixed, but the DB still doesn't connect the pattern to the exchange type. Will try adding it manually in the app, observe the effect through the admin interface, and learn something. Alternatively, the patterns in the DB will not change at all, but changes will be shown in the UI, and I will learn nothing.
Aha. There is a class TransferTypeFacetValue in the models.... but it's totally inaccessible from the admin interface. Well, at least I can get rid of the Process patterns I made.
aaaand add the "patterns" (transfer type facet values) back through the app.

Created issue: Inventory/Resource Types page is ugly. #16
Will fix tomorrow.

May 1, 2018 1.98 Time - Hours Done by davidh

Start fixing issue: Graph on home page broken #13
Most likely due to the Home Page Layout in the DB (the canvas element in here is not even in the template)
The layout doesn't have the canvas either. It's generated by the library static/jquery.maphilight.min.js
Since it's minified, it will be difficult to figure out what's going on. Looking for the source version.
Interesting. The image itself is 691x457, but the canvas in the Verdun homepage sizes the canvas as 830x447. Something to ctrl-F in the source code maybe?
Nope, the dimensions were set manually in the HomePageLayout object. Punched in the correct dimensions, should work immediately.

Resuming work on issue: Forms using chair_tag.py are ugly #12
At least one case is screwed up by an oversized description, trimming that as a kluge.
Increased line height for containing elements, protected li elements inside forms from styles that disable their bullets.

April 30, 2018 4.85 Time - Hours Done by davidh

Found issue: TemplateDoesNotExist at Create Exchange #9
Examining exchange_logging.html
Looks like the {% include %} tags need the full path.
Fixed that.

Now encountering:
TemplateSyntaxError at /accounting/exchange/1/0/
Could not parse the remainder: ',' from 'xfer.change_commitments_form,'
On the same page.
Found some syntax errors on the included form, _commit_form.html, not sure if that could interfere.
Also found a comma in the arguments to {% include %}, which is likely the source of the problem.
Also improved some other spots in _add_xfer_form.html

Now I get:
TemplateSyntaxError at /accounting/exchange/1/0/
Could not parse the remainder: ',' from 'slot.add_commit_form,'
Obviously this is another syntax error of the same nature
Works now, but I may want to revisit to check out all the case-specific renderings

Found issue: Create Order dies #10
Clear solution here. I can fix this particular problem easily and quickly, bur we need to decide whether we are implementing customer orders or not. According to previous communications with Bob, the tests never passed and the functionality was never used, which is why there is an import there. If we want to have customer orders, I need to fix this AND the issues revealed by the tests. If not, I need to disable the button and not worry about it. Will defer here.

Found issue: Production Planning looks like something is missing #11
The view function, process_selections(), has a variable slots, which should give the context a list of resource types. The function is fairly complicated.
Could be related to lack of EventTypes? Probably not, unless the project is supposed to be associated somehow with the event types and it isn't.
on lines 9535 to 9538:
slots = selected_pattern.event_types()
slot.resource_types = selected_pattern.get_resource_types(slot)
Since the slots appear to be present but unfilled, it's most likely an issue of process_pattern.get_resource_types(event_type) not finding any resource types. Checking out models.py
This is the function that is filtering resource types based on the resource type facet values, which it gets from self.facets_for_event_type(event_type)
Looks like the resource types associated with the dummy project need more facet values, as they don't match these filters.
Tried that, still coming up empty. Could be due to incomplete list of facet values or poorly assigned facet values to patterns or resource types; will ask Tiberius to review them.

Found another instance of issue: UnboundLocalError when creating exchange without exchange type #3
Will give this similar treatment (alert at template level) and fix at the forms.py level as well.
Went ahead and added required=True to all of the WhateverNavForm classes.
Moved the preventDefault() definition used by all of my events that need to do so to its own template, _prevent_default.html (event.preventDefault() is deprecated, event.defaultPrevented is not universally supported)
Added click events at all 3 locations.
Verified that all 3 cases work as expected for the case of no selection. However, in the case of exactly one exchange type present, the :selected selector doesn't pick up the very much selected option. Will have to add a line to select the first option by default. Fixed.

Fixed up create_exchange.html with type aliases.

Found a really ugly form via create_exchange > Save Changes > Log a new Transfer Event. Could be due to the {% field_as_div %} tag from chair_tag.py; trying that out, since it would be more convenient to edit in one place.
Turns out it's due to the label element; replacing that.
Still doesn't look right; starting issue: Forms using chair_tag.py are ugly #12
and picking it up tomorrow.

April 30, 2018 0.00 Time - Hours Done by davidh
April 26, 2018 4.77 Time - Hours Done by davidh

Found bug: UnboundLocalError when creating exchange without exchange type #3
Fixing.
Added an alert and preventDefault() when the exchange type is not selected. Still needs to be tested to make sure that it works when an exchange type IS selected, but we currently have no defined exchange types for this agent.

Found bug: Layout of agent page has "add to map" on same line as "Photo" #4
Fixing that too. Added div elements as chair_tag would have if the a elements could have been put in by that tag.

For testing, created an order for lemonade, "I am thirsty"
Found bug: TemplateSyntaxError at /accounting/process #5
Looks like there's a few missing symbols there. Added a }, fixed.

Edi-table on accounting/contributionhistory/ is off. The Edit button is missing. The Deliverables column is empty. The unit "Hours" has no space in front of it. Created issue: The edi-table on contribution history is a mess #6
Shouldn't have replaced the textual Edit button with an <i>. Made it an a.btn.btn-large with "Edit".
Added a leading space to the data-suffix in the quantity column.
Removed the data- properties from the Deliverables column; this column was never editable, so the json override was abandoned. If the column is still empty, it's probably due to the DB having an empty field due to my naive data entry rather than an actual bug.
Since the quantity column doesn't start out managed by the edi-table JS, had to add a space in the initial output too.
Seems that the datepickers aren't working; probably because I commented out the datepicker() calls. Adding them back.
Now it appears that the Save button is, once again, trying to submit the form and navigate away. How is this still happening? Looks like the form still has its enctype attribute, which should have been stripped. Used the wrong span class to install the editor in the first place, so who knows what will happen now.

Checking out process_oriented_logging, it looks like an image is missing. Evidently our static files have not made it into the static app on the server. Looking into that. Messed with settings, that was necessary but didn't fix it. Fixed by uploading proper files to the repository (there was a directory mixup the first time, my bad) and collecting statics on the server.

Found issue: TemplateSyntaxError at /accounting/create-resource-type-list/ #7
Fixing by removing nested comment. Trying to replace the inner comments with {# #} syntax so that the inner comment can be preserved, otherwise if the block is ever un-commented, the inner comment block will return to haunt us. Worked, but now the form.as_ul looks ugly. Let's see if it's better with |as_bootstrap. Unfortunately I may need to sweep this across all the templates, but it was somewhat uncommon. Looks nicer if the checkbox is simply labeled by the resource type name, rather than a read-only textbox. Trying it out. Hmm the label showed "None" below the checkbox itself. Will need to use .value() instead of .data and either move the input into the label or move the label text into the input widget (probably easier to do with JS than the django template).

Checked out incoming exchanges page; for some reason the exchange type variable is not being replaced.
Created issue: Typename variable not replaced in incoming exchanges #8
Found that the template still features the variable nested in a {% trans %}. Changed to use |tr.

April 25, 2018 2.12 Time - Hours Done by davidh

Continuing fix of #1: Non Production Logging form
Fixed several issues:
Forgot to add the edit column. Added. Moved the time total right by one cell to put it under the hours total.
Used parseFloat instead of idiomatic casts for durations expressed as hours/minutes widget.
Coerce the values() iterator to an array before getting the first element in EdiTable.table().
Remove enctype from all modal edi-table forms, as the async saves don't need to navigate either.
Problem: the durations are apparently still not calculating properly. Also, it's still wanting to submit the form and navigate.
Added a save() call on the table after loading to calculate the total; at load, it calculates correctly.
After the pull that fixed that, the navigation problem appears solved, too.

April 20, 2018 3.43 Time - Hours Done by davidh

Starting regression test on edi-table using agent-associations
hmmm it claims that there is no view for that page, which is clearly wrong - must have introduced an error in the last commit to views.py causing it to fail. Rolling it back to test theory. Nope! It was in forms.py; I had HiddenField instead of HiddenInput.

It looks like something broke. The form still insists on doing its default behavior, which means the enctype wasn't removed, Sure enough it's there. Also got an exception, data is undefined, which probably crashed a function before the attribute was removed. Seems to be the change that allowed the simple output to have a prefix & suffix; took the simple output and made it examine the data attributes to be a little more intelligent about this.

Dialog pops now, no exceptions, but the fields aren't being updated right; in particular, the agent field disappears from the form control and the table. The input is actually fine; the output span just isn't updated. Now it works.

Looked at the create resource type page; it had a funny facet list where the facets were not shown. Fixed that, now things just look ugly. Fixing it up.
Now it looks pretty good.

April 20, 2018 0.50 Time - Hours Done by davidh

Fixing #1. Caused by implicit cast failure while altering table contents.

April 18, 2018 6.37 Time - Hours Done by davidh

Checking out additional targets for the edi-table.
I'm on agent_contributions.html, fixed a markup error. The embedded forms are really weird; there's a form for each field that can be edited, and the saves are caused by change events. There is a link to change_event.html in the last column of the table right beside delete. What I think I'll do is move that to its own first column and include the form from change_event.html as a modal. change_event.html is just a form|as_bootstrap anyway. Since there is also a model field for deliverables, which are not on the form itself, I also needed to make an API entry point in urls.py and views.py to fetch the deliverables when the table is synced. In order to get a queryset for the JSON, I needed to alter the process.deliverables() function to return a queryset as well. Finally, the edi-table needs to be able to handle both async save and load, as well as several new data types.

That's that, can't test it until there is some contribution data in there. Moving on to the next target.

That is unscheduled_time_contributions.html. The table here has a tally of hours at the bottom; have to extend edi-table to take arbitrary callbacks when the form saves, Introduced an EdiTable class at document scope that has static methods to retrieve the table you want, and instances have methods to get columns, rows, column headings, do an onSave, etc. Also added another datatype override. Set up in the target HTML to recalculate the total hours when the modal is saved. Finally had to rework the edi-table to handle multiple controls per table cell since the table uses a custom widget with multiple input elements. Should regression test with agent-associations.

April 17, 2018 5.28 Time - Hours Done by davidh

There is no workparty; getting back to the edi-table.
Fixed a few easy bugs

Now looking for the source of two incomplete namespace errors:
- The form_dialog can't seem to find its dialog_id; looked at the call in the template (it's specified by name), python function in templatetags (the argument is there and not given a default string, so if anything, the concatenated defaults e.g. form ID should be appended with 'None' if the function can't see it, and it's also in the returned dictionary as specified in Django docs). Changed the python function to raise instead of return to see how the function sees it.
- The JS is throwing on rowEditor.wrapVal() in rowEditor.syncTbl() claiming it isn't a function. Verified that the default for non-overloaded fields is rowEditor.simple() and that all overload functions return a function. Verified that it's assigned during rowEditor.install() and that install() is called from the editor constructor. Added a default method for wrapVal() that throws the field details to get a better idea of what's going on (or, if I get no more throws, the class just wants the method defined and I can let it go).

Clearly the python function gets '' as dialog_id, though I can't see how. Could be that concatenating the array index silently fails thanks to the index being an int; converting it to string via |tr; now that's throwing too because of the ugettext_ugly function. Adding an explicit convert-to-string only in chair_tag.py
It's stupid that it worked. Let's not use Django next time.
rolling back form_dialog.py

On the JS diagnostic, the offending element is the submit button. Verified that the constructor doesn't add input[type=submit] to its fields or call install(). In fact it shouldn't even call the constructor, so it's unclear how the element gets a RowField at all.
Switched things around to use $().is(':submit') instead of comparing attributes. Also improving diagnostic throw just in case to identify matched elements. Now it seems the CSRF token is showing up, and obviously that doesn't belong either (although why it wouldn't be assigned a wrapVal function is a mystery). Filter the fields by :not([type=hidden]).

jQuery now throws when appending the description. Used reduce to cram all the <p> into a <span>.

Now the input elements are showing up in the table anyway. It seems as if the <select> doesn't show up, but the chosen library adds additional elements; could be the case that chosen is hiding those itself. Wrapping the form hidden elements in a display:none container. Also adding .delete to the delete field's td so that, if the CSS works, it won't be hidden.

The edit buttons now fail to pop the modals. No exception is thrown. My HTML is already following the Bootstrap docs to the letter, but it's worth modifying the HTML to use sample code from the library just to make sure. Also adding a call to focus() instead of counting on bootstrap to do that itself. Also converting the index to string explicitly, though that seems to be going alright already.
Checked the href itself, missing the word "has", so that will probably fix it.
Fixed typo.

The submit button is wanting to reload the page; tried a few ways to intercept this behavior while re-using the form_dialog template. Got it.

The cancel button is still saving the data. Apparently that somehow turns up with :submit selector. Added a class, .cancel, as a hack to prevent this.

The submit button now fails to close the dialog. Hacking the click handler to close the modal manually.

Models display as text, save as primary key, link when appropriate? Check.
Delete works? Check.
Dialog pops? Check.
Dialog closes on save? Check
Dialog closes on cancel but doesn't update table? Check.
Looks like we're good.

Now to check it out on my phone...
As predicted, the table still looks bad and messes with the page flow, which we decided to not get rid of. But the edit dialog is easy to find, pops right, saves right, looks slick. I think we have a winner.

Implementing for the is_associate table. Picture perfect.
Implementing for unscheduled_time_contributions.html. View of same name. Url accounting/unscheduled-time/. As of now it redirects to accounting/work. Possibly because there are no projects. Also looks like the view redirects if the agent is not found via get_agent().

Adding a bunch of test data to use for a dummy project. The resource class I use for all resources is Test. Added:
Resource Types: Lemonade, Lemon, Water, Juicer, Sugar, Squeezing
Agents: Lemonade Stand
Holding for input on how to set up the rest of the model system.

April 17, 2018 1.15 Time - Hours Done by davidh

Testing out the new editable table before the workparty

April 13, 2018 3.18 Time - Hours Done by davidh

Continuing to work on editable table.
Tried several approaches to getting Django to help with this, ended up doing the whole thing with ES6+ & jQuery.

April 12, 2018 7.42 Time - Hours Done by davidh

Picking up syntax fixes with process_oriented_logging.html
Modified chair_tag.chair() to handle object fields a little better.
Added a filter, |s to pluralize pre-translation, will sweep through previous commits with ack-grep to implement.
Added another chair_tag filter, |sp, to concatenate with a space added. This is for convenience, no need to sweep previous commits.
Finished with syntax, pulling to server, grepping for |s
Finished with that, resuming debugging

Fixed missing load in agents.html

Fixed typo in agent.html
Fixed more syntax in agent.html
Now the URL is acting silly. Used |escape and |safe to prevent default escaping.

Fixed missing load in demand.html

Supply.html claims it can't find the variable 't_xchg' on line 89 when it clearly can on line 82, still looking into why.
Apparently outer scope variables aren't visible from inner scope. Let's not use Django next time.
Done sweeping that up.

Fixed missing space in demand.html

Resuming going down the list of accessible pages with agent-value-accounting, but now that I look at it this is an unnecessarily convoluted approach because I'll end up trying to create a lot of objects at random. I'd better come up with a model system first.

Caught a template I missed when moving declarations around, exchange_types.html, and fixed.

Switching gears to check out the editable table prototype in agent_associations.html
Can't seem to find the dialog_id variable for the form_dialog includer. Fixed the syntax on that, maybe that will help. Nope.
Changed the python tag library code to construct default arguments in the function

April 12, 2018 2.00 Time - Hours Done by davidh

Been working on the editable table

April 11, 2018 4.68 Time - Hours Done by davidh

Debugging HTML output and UI
The page title appears to be example.com; this is wrong. The site name should be in a template variable SITE_NAME per valuenetwork/templates/theme_bootstrap/base.html
That was a lot more difficult to find on documentation than it should have been. Updated the SITES config in settings.py
That caused an error, so I rolled it back and went in through the admin interface to change it through the DB.

Tried to check on agent_assoc_type.html, but it's not accessible.
Need to add an agent to check out agent_associations. Also this is the editable table prototype. Trying to get to the simple stuff at the moment, will return to this.

agent_type.html : no view can access this.

agent_value_accounting.html : view agent_value_accounting : url accounting/agent-value-accounting/<agent>/
Can't nest {% trans %}. Snap. That syntax error is probably going to pop up everywhere. Replaced in this case with {% trans as %}, but I bet it will be easier to move the localizations to the chair_tag.py or chair.html. Set it up in chair_tag.py; now it just needs to have the {% trans %} removed.
Need to coerce to string also.
And now it won't replace the template variables inside the tag; again this will pop up everywhere. Need to replace all instances of "const{{var}}" with "const"|add:var
Since this {% {% trans %} %} thing is crazy common, making a quick filter to use ugettext_ugly

Fixed everything down to process_oriented_logging.html
Will continue tomorrow.(files committed but server not yet updated)

April 7, 2018 0.00 Time - Hours Done by davidh
April 6, 2018 5.78 Time - Hours Done by davidh

Examining HTML output of resource_type.html template to determine what is happening with the quantity element of the form (which should not be there)
Sure is there, trying to get rid of it by eliminating the assignment in the form class. Also making sure the resource type typename alias is working.
Neither of those things worked. Attempting to remedy the extra field first by following the Django doc example of doing so to the letter. Also added print of context to diagnose typename aliases.
Neither of those worked either. Neither did setting up a Meta.fields (rather than relying on Meta.exclude). Used diagnostic print to verify that templatetags.types was loaded, still not sure why the variable is not being replaced.
Trying an inelegant hack, copy-pasting the desired fields into the form class rather than using inheritance. That did it. Still need to figure out the type tag issue, but will put together a separate test.

Starting work on the other 2 failures: test_explosions cycle occurs when an explosion repeats itself (grandchild_input.quantity == 5 but should be 15)
and exceptions in ValueEquationTest.setUp() (child_input.associated_producing_commitments() is empty)

Going for the exceptions first.
associated_producing_commitments sees producers = [<Commitment: make child produces 2 child>]
oops. That time was a no-throw. child_output = <Commitment: make child produces 2 child>
...... with the debugger running, the exception doesn't occur........... usually.
when it does, Commitment.objects.all() still shows the same object does exist (as do all previously existing Commitments)
looks as if, when not crashing, child_input is <Commitment: make parent consumes 2 child>
when crashing, child_input is <Commitment: make parent uses 1 hr usable type>
That can happen because process.incoming_commitments() returns a list of 2+ commitments, and the test arbitrarily chooses [0] instead of the right one.
For now the quickest fix seems to be modifying the test to set child_input to process.consumed_input_requirements().get() to narrow it down to the one that consumes the child resource type. While I'm at it, there's another query of the child_output.process.incoming_commitments()[0], which could just as easily crash. Changing that one too. While the other [0]'s of QuerySets should be get() as well, I'm not 100% sure they're not actually lists being returned by these functions.
Need to narrow it down by RT.
That fixes the setUp() errors, and somehow averts the test_explosions failure too (but probably not always), but there is one additional erring associated_producing_commitments in test_setup. Same errors made & fixed there.
Ran perfectly (at least once)

Now that I look at the other test, it seems as if it's caused by roughly the same underlying issue. Trying roughly the same fix.

All (automated) tests now pass. What's left is the UI and template tags tests.

April 5, 2018 1.07 Time - Hours Done by davidh

Put together instances of User, EconomicAgentType, EconomicAgent, and AgentUser in setUp function for the #512 fix test case. Evidently that wasn't the end of it. After verifying that the dummy agent actually makes it into the template context, the test proceeds to fail by containing the offending quantity control after all. Next step is to take a look at the actual html output.

After that, on to 5 == 15 and the empty collections.

April 4, 2018 3.50 Time - Hours Done by davidh

Fixed tests. Elected to delay repairs to the order form code that has apparently never worked so that I can address the remaining fails rapidly.

Lost a lot of log here somehow, but as I recall, the test I wrote for issue #512 still throws because the template only renders the forms under examination if the template context includes a Truth-y value for user. I'll likely have to modify the test case instance to generate a user and bind it to an agent to get it to work.

Four tests in the same test suite (test_value_equations.py), throw on the very same line for retrieving the first element of an empty list. This means that I can solve the problem quickly by finding the source of the list and initializing it appropriately.

The last pesky failure is within the test_cycle test case. where grandchild_input.quantity is 5 when it should be 15.

April 4, 2018 7.27 Time - Hours Done by davidh

Pulling down from repo from git
Rerunning tests

.........F............F.E...F...F.F........EEEE
======================================================================
ERROR: test_create_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order view
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 160, in test_create_order
response = form.submit("submit1").follow()
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/forms.py", line 619, in submit
params=fields, **args)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/response.py", line 297, in goto
return method(href, **args)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django_webtest/__init__.py", line 139, in post
upload_files, expect_errors, content_type, **kwargs)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/app.py", line 379, in post
content_type=content_type)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/app.py", line 755, in _gen_request
expect_errors=expect_errors)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django_webtest/__init__.py", line 86, in do_request
expect_errors)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/app.py", line 625, in do_request
res = req.get_response(app, catch_exc_info=True)
File "/home/valnet/lib/python2.7/webob/request.py", line 1323, in send
application, catch_exc_info=True)
File "/home/valnet/lib/python2.7/webob/request.py", line 1291, in call_application
app_iter = application(self.environ, start_response)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/lint.py", line 200, in lint_app
iterator = application(environ, start_response_wrapper)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 67, in __call__
return self.application(environ, start_response)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/core/handlers/base.py", line 177, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/core/handlers/base.py", line 109, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 20, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/views.py", line 3067, in create_order
ext_id = request.POST["exchange_type"]
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/django/utils/datastructures.py", line 258, in __getitem__
raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
MultiValueDictKeyError: "Key 'exchange_type' not found in <QueryDict: {u'RT-90-description': [u''], u'due_date': [u'2018-04-05'], u'RT-89-quantity': [u''], u'RT-86-quantity': [u'3'], u'RT-90-quantity': [u''], u'description': [u''], u'RT-89-description': [u''], u'RT-86-description': [u''], u'provider': [u''], u'submit1': [u'None'], u'RT-89-resource_type_id': [u'89'], u'RT-86-resource_type_id': [u'86'], u'receiver': [u''], u'csrfmiddlewaretoken': [u'MczMC7BIXCS40TzxE5kO3CQ0Sz722FlR'], u'RT-90-resource_type_id': [u'90']}>"

Evidently the CreateOrderForm once but no longer contains a field for an ExchangeType.

======================================================================
ERRORS:
test_contribution_shares (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_distribution (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_rollup (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_rollup (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_setup (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_value_equations.py", line 184, in setUp
child_output=child_input.associated_producing_commitments()[0]
IndexError: list index out of range

will look into how child_input.associated_producing_commitments() could be empty.

======================================================================
FAIL: test_cycle (valuenetwork.valueaccounting.tests.test_explosions.ExplosionTest)
cycles occur when an explosion repeats itself:
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_explosions.py", line 128, in test_cycle
self.assertEqual(grandchild_input.quantity, Decimal("15"))
AssertionError: Decimal('5.00') != Decimal('15')

Still looks painful

======================================================================
FAIL: test_no_quantity (valuenetwork.valueaccounting.tests.test_resource_types.NoQuantityTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_resource_types.py", line 28, in test_no_quantity
'/accounting/resource-type/%s/' % self.rt.id
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/response.py", line 101, in follow
% self.status)
AssertionError: You can only follow redirect responses (not 200 OK)

Looks like this has to be hard-set as a non-redirect, which I don't like, but, meh.

======================================================================
FAIL: test_create_workflow_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order for a workflow item
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 211, in test_create_workflow_order
form[self.rt_form_name(self.rt_by_id(9), 'quantity')] = 2000
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/forms.py", line 516, in __setitem__
% (name, ', '.join(map(repr, self.fields.keys()))))
AssertionError: No field by the name 'RT-129-quantity' found (fields: u'csrfmiddlewaretoken', u'provider', u'receiver', u'due_date', u'exchange_type', u'description', u'submit1', u'RT-132-resource_type_id', u'RT-132-quantity', u'RT-132-description', u'RT-131-resource_type_id', u'RT-131-quantity', u'RT-131-description', u'RT-128-resource_type_id', u'RT-128-quantity', u'RT-128-description', u'submit2')

Will try fiddling with the resource types again

======================================================================
FAIL: test_order_validation (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test fix for #510 Create order blows up: at least one item must have quantity > 0
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 194, in test_order_validation
self.assertIsNone(e, msg="setting form fields or submit threw %s" % (str(e),))
AssertionError: setting form fields or submit threw "Key 'exchange_type' not found in <QueryDict: {u'due_date': [u'2018-04-05'], u'RT-172-description': [u''], u'description': [u''], u'RT-171-quantity': [u'0'], u'RT-172-resource_type_id': [u'172'], u'provider': [u''], u'RT-171-resource_type_id': [u'171'], u'submit1': [u'None'], u'RT-168-description': [u''], u'RT-172-quantity': [u'0'], u'receiver': [u''], u'csrfmiddlewaretoken': [u'pbkZrbHdhuF2upHKnOe6Zyh4053NHbua'], u'RT-168-quantity': [u'0'], u'RT-168-resource_type_id': [u'168'], u'RT-171-description': [u'']}>"

Exchange type doesn't exist in the OrderForm.

======================================================================
FAIL: test_two_workflow_item_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order for two workflow items
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 247, in test_two_workflow_item_order
form[self.rt_form_name(self.rt_by_id(9), 'quantity')] = 2000
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/forms.py", line 516, in __setitem__
% (name, ', '.join(map(repr, self.fields.keys()))))
AssertionError: No field by the name 'RT-189-quantity' found (fields: u'csrfmiddlewaretoken', u'provider', u'receiver', u'due_date', u'exchange_type', u'description', u'submit1', u'RT-192-resource_type_id', u'RT-192-quantity', u'RT-192-description', u'RT-191-resource_type_id', u'RT-191-quantity', u'RT-191-description', u'RT-188-resource_type_id', u'RT-188-quantity', u'RT-188-description', u'submit2')

Will fiddle with resource types again.

----------------------------------------------------------------------
Ran 47 tests in 17.851s

FAILED (failures=5, errors=5)

Bob revealed that the entire order test suite was dropped and never worked. Although I have a strategy for matching the objects under study to their primary key, it's going to be a little more involved to fix the view function. Though I'm certainly up to coming back for this one, I'm just commenting out the import for now. I'll also seal off the view function just so it doesn't see any accidental traffic.

push, pull, manage, test, that leaves us with...

.........F............F.........EEEE
======================================================================
ERRORS:
test_contribution_shares (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_distribution (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_rollup (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
test_setup (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_value_equations.py", line 184, in setUp
child_output=child_input.associated_producing_commitments()[0]
IndexError: list index out of range

Investigating where the associated_producing_commitments are coming from.

======================================================================
FAIL: test_cycle (valuenetwork.valueaccounting.tests.test_explosions.ExplosionTest)
cycles occur when an explosion repeats itself:
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_explosions.py", line 128, in test_cycle
self.assertEqual(grandchild_input.quantity, Decimal("15"))
AssertionError: Decimal('5.00') != Decimal('15')

Not looking forward to this at all.

======================================================================
FAIL: test_no_quantity (valuenetwork.valueaccounting.tests.test_resource_types.NoQuantityTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_resource_types.py", line 36, in test_no_quantity
self.assertIsNotNone(res_form, msg='form#resourceForm not found')
AssertionError: form#resourceForm not found

That would mean the template has some condition for rendering the form#resourceForm. It does require a truthy agent. The agent comes from a property of a user object, found by request.user.agent.agent in this case. No agent property belongs to Django User as is documented by django, so how it gets there and sticks is a little mysterious.

What I have been able to put together from the Django docs and the valnet NRP's models is a bit hackish. In this and many other cases, classes with little to no logical purpose except to convince the DB and Django to store relationships between objects as objects themselves. A P2P NRP would not need this pattern, but here it is. In models.py:

class AgentUser(models.Model):
agent = models.ForeignKey(EconomicAgent,
verbose_name=_('agent'), related_name='users')
user = models.OneToOneField(User,
verbose_name=_('user'), related_name='agent')

----------------------------------------------------------------------
Ran 36 tests in 11.890s

FAILED (failures=2, errors=4)
Destroying test database for alias 'default'...
(verdun) [valnet@wf-207-38-92-205 VerdunNRP]$

April 4, 2018 3.48 Time - Hours Done by davidh

Debugging for test failures.

======================================================================
ERROR: test_no_quantity (valuenetwork.valueaccounting.tests.test_resource_types.NoQuantityTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_resource_types.py", line 33, in test_no_quantity
doc = ElementTree.fromstring(resp.content)
File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1300, in XML
parser.feed(text)
File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1642, in feed
self._raiseerror(v)
File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
raise err
ParseError: mismatched tag: line 77, column 6

This is my bad, one of the first tests I wrote used the ElementTree instead of Django's HTML inspection classes. Will fix.

======================================================================
ERROR: test_contribution_shares (valuenetwork.valueaccounting.tests.test_value_equations.ValueEquationTest)
x4
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_value_equations.py", line 184, in setUp
child_output=child_input.associated_producing_commitments()[0]
IndexError: list index out of range

There are 4 of these, likely related to lack of object population when tests are run.

======================================================================
FAIL: test_cycle (valuenetwork.valueaccounting.tests.test_explosions.ExplosionTest)
cycles occur when an explosion repeats itself:
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_explosions.py", line 128, in test_cycle
self.assertEqual(grandchild_input.quantity, Decimal("15"))
AssertionError: Decimal('5.00') != Decimal('15')

This is going to be painful.

======================================================================
FAIL: test_create_order (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test create_order view
Test create_order for a workflow item
Test create_order for two workflow items
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 139, in test_create_order
form["RT-6-quantity"] = 3
File "/home/valnet/Envs/verdun/lib/python2.7/site-packages/webtest/forms.py", line 516, in __setitem__
% (name, ', '.join(map(repr, self.fields.keys()))))
AssertionError: No field by the name 'RT-6-quantity' found (fields: u'csrfmiddlewaretoken', u'provider', u'receiver', u'due_date', u'exchange_type', u'description', u'submit1', u'RT-90-resource_type_id', u'RT-90-quantity', u'RT-90-description', u'RT-89-resource_type_id', u'RT-89-quantity', u'RT-89-description', u'RT-86-resource_type_id', u'RT-86-quantity', u'RT-86-description', u'submit2')

Will look at the template to see if this is my fault. Doesn't look like it. The hard-coded "RT-6-quantity" etc. seem to be very brittle. Will change to a more sensible abstraction, but it's guesswork as to which resource type they actually meant when the tests were written. I'll go ahead and guess they're in the order they were created.

======================================================================
FAIL: test_order_validation (valuenetwork.valueaccounting.tests.test_orders.OrderTest)
Test fix for #510 Create order blows up
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/valnet/webapps/verdunnrp/VerdunNRP/valuenetwork/valueaccounting/tests/test_orders.py", line 167, in test_order_validation
raise AssertionError((_('an empty order should not throw, but threw %s' % str(e)),))
AssertionError: (<django.utils.functional.__proxy__ object at 0x3c54f90>,)

Used the wrong syntax for the error message, will make it more informative. Also changed it around to use the Django and unittest assertion methods, again for clarity.

Test create_order view now errs: request.POST['exchange_type'] does not exist in views.py. The dict looks like a form dictionary for CreateOrderForm.
The other two tests look like, for whatever reason, the ID numbers are incremented by 1.
Once eliminating the rest of the problems with the test of zero quantity orders (#510), it errs like create_order view.

picking this up tomorrow.

April 4, 2018 0.92 Time - Hours Done by davidh

In lieu of response from django-notification library devs, exploring possibility of developing a shim. Could go with a notification shim for the project or a feed shim for notification. Imports of the library occur and are used in valuenetwork/valueaccounting/views.py, /management.py, and /urls.py, whereas the library imports django.contrib.syndication.views.feed only in its own views.py.
Their views.py only uses the feed function once, in function feed_for_user.
Docstring: """An atom feed for all unarchived :model:`notification.Notice`s for a user."""
Let's see if we even use that function. No we do not! Whew.
Implemented hack.

April 3, 2018 2.03 Time - Hours Done by davidh

Laptop crashed a moment ago -- maybe this thing does have an insane memory leak after all.

Getting back to pointing all the tests at the new fixture file, verdun.json.

Tests now run.

5 throw due to the notifications library attempting to import django.contrib.syndication.views.feed, which does not exist. Probably needs yet another version shift.

in test_value_equations.ValueEquationsTest,
test_contribution_shares throws an index out of bounds on child_output = child_input.associated_producing_commitments()[0]
test_distribution throws same on same statement
test_rollup throws same on same
test_setup throws same on same

in test_explosions.ExplosionTest.test_cyle, test fails "cycles should occur when an explosion repeats itself" on assertion grandchild_input.quantity==Decimal("15")

re: notifications, we're already rolled back beyond their changelog, so it's a guessing game. Installing yolk to catalog available versions. But yolk throws for whatever reason, so I'll just guess version 9001 and see what pip's error message lists as available.
0.1.5 doesn't work.
0.1.4 doesn't work.
0.1.3 doesn't work, and somehow causes a new test failure for #510
0.1.2 same
0.1.1 weirdest yet, it fixes all of those ValueEquationsTest errors. That seems impossible. But still doesn't work on import.
0.1.0 restores those index errors and still doesn't fix the imports, and we're out of versions to try.
As I recall, 0.6.4 drops compatibility with django 1.4, and pip doesn't have anything between 0.2 and 0.6.4. Will have to try to find it elsewhere.
Does not exist as far as I can tell. Will send out a bunch of emails to see if one of the authors has a compatible copy lying around, and to Bob & Lynn to see if we can get rid of the library safely.

April 2, 2018 3.73 Time - Hours Done by davidh

Setting up a private DB for the verdun nrp to run tests on.
Updating local_settings.py to use said DB

Tests and presumably everything else fail if the app parameter to post_migrate callbacks is not "valueaccounting". Need to change the models.py self-installing fixtures through this signal to create UseCase etc instances that other classes depend on.
Fixed create_use_cases, create_event_types, create_usecase_eventtypes, create_agent_types, create_agent_association_types
Didn't work, still not creating these objects for the tests
Creating a fixtures file... nah, tedious and over-complicated. Adding an override to the corresponding manager classes that will install the fixtures the first time the get() method is run. Also not going to work, too many entry points to the query to catch the empty query effectively.
Fixtures it is.
Wrote a JS script that consumes the initialization code and generates a fixture. Keeping it around just in case.
Generated all necessary fixtures.
Apparently all the test case classes also need to be pointed at the fixtures. Doing that. Unless all these open files run me out of memory.

April 2, 2018 0.00 Time - Hours Done by davidh
April 2, 2018 1.58 Time - Hours Done by davidh

Fix work init script init.sh to set DJANGO_SETTINGS_MODULE successfully.
Now I'm hitting an exception from the corsheaders library, which is trying to import from a module called mock. Definitely doesn't exist as far as I can see. Could be referring to the python 3+ unittest.mock
In any case it was fine this morning. Will look over pythonpath and see if it could be looking at a different version.

Fixed local_settings to use the DB owner so the test database can be accessed.
That table had all rows created by the old user, so I switched local_settings back and made that user owner.
Still not working, and webfaction is now failing to fetch information about the databases.
Rather than trying to untangle this, it's probably quicker to wipe both DBs and start them over with valnet as both owner and user. As soon as webfaction will let me do that.

April 1, 2018 3.00 Time - Hours Done by davidh

Bug fixes

Invalid syntax: Fixed a missing comma in models.py

Transaction aborted: Related to the new Unit.default_unit()
In class EconomicResourceType initialization of field unit, changed default to be a reference to the Unit.default_unit_id function instead of the value of the default unit itself.

During manage.py migrate, there was a failure related to easy_thumbnails. Added the appropriate fix to local_settings.py, but now I'm thinking it might as well go into settings.py in the repo so that no one else has the issue.

During manage.py migrate, the lib account.migrations attempts to import django.db.migrations, which does not exist. This is likely to be another rollback issue, but the library itself is not included in requirements.txt or the installation instructions. Thus it's downloaded as a dependency of one of these other libraries.
Or, it could be a name clash; in the INSTALLED_APPS in settings.py, "account" is under the local project heading. There is a VerdunNRP/account as well as a python2.7/account. The fact that the lib version is obviously not compatible with django 1.4 is an issue, but it's possible that the wrong module is being loaded here.
The offending library is django-user-accounts from the pinax project. The docs explicitly say django 1.8+. Requirements.txt does explicitly give a version for the pinax-related libraries though. The earliest version in their changelog (1.1.0) breaks compatibility with django 1.4.
Rolled back to 1.0, uninstalled 2.0.3. Perfect. Adding to requirements.txt

Tried to load fixtures, help worked, starters did not.

Set up email in local_settings.

Corrected a syntax error in views.py
Removed error message (that was apparently problematic) in models.py class OrderItemForm
Unexpected **kwarg default, same class, same field.
Could also be related to the lack of required **kwargs max_digits and decimal_places. Set to 10 and 4 respectively.
Oops. That's a forms.Field, not a models.Field. Removed default.

Fixed account settings to stop emailing Bob.

Tests do not want to run for lack of test database, even after creating one explicitly via webfaction. It says that permission to create or delete databases is denied.

March 27, 2018 1.67 Time - Hours Done by davidh

Finishing work on issue: Process logging - display Type of work description #461
done

Evaluating issue: Adding more flexibility to the pattern setup process #460
This is a problem for scaling, so it could be necessary. Came up with a rough design to solve the problem, not implementing until I know we need it

Evaluating issue: Incentivizing practices with less-harmful side effects, and/or intangible benefits #459
Feature request, not a priority

Issue: Use internal credit resource rather than claims #455
Refactoring, not a priority

Issue: Don't require process patterns #454
Seems like a usability issue as we scale. We could also factor the pattern out of the UI, i.e. merge the pattern editing page into the process editing page, edit the process data without referring to any patterns, but keep the patterns in the backend as first class entities. This would significantly increase the number of patterns in the DB since they would not be reused in most cases, and ultimately I think it might be more difficult to work with resource types in processes because you would have to reconstruct your facet filters all the time or choose from really long listboxes. I think we should solve at most one of #454 or #460 since they are directed at the same issues.

Issue: UI - themes #452
I like the idea, it seems to tie in with the dashboard interface. It also doesn't seem to differ that much from adding or modifying options of the top level menu. Will look into it.

For now breaking from this to try and get the server running.

March 26, 2018 2.32 Time - Hours Done by davidh

Re-evaluated agent_contributions.html. This is a target for the editable table design.

Revisited create_distribution_using_value_equation.html
examined view function in views.py, form in forms.py
Second table (calculated distribution quantities) is a real table, first is absolutely not. Reworking it using field_as_p.

Revisiting create_order.html
fixed a typo
The way the page is organized, the table makes sense, but it seems like a very unorthodox way to put together an order. Probably better to make a catalog-like interface with modals for each item. Maybe bootstrap has something, I think jQuery UI has something like that as well.
If I recall correctly, this page was never really used. Better verify that it's necessary before making a sweeping change like that.

Revisiting unscheduled_time_contributions.html
This is another good target for editable table design once that's tested.

Getting back to issue: Project page and financial contributions - UI UX #471
Could fix, need more detail. Overall may not be a priority.

Issue: Validation on cash account on Distribution page #467
Can be done pretty quickly. Adding an override to DistributionValueEquationForm.clean(). Fixed.

Issue: Easy thumbnails migrations mismatch #466
Seems like it's already fixed

Issue: process logging get-directional-unit bug #465
I already fixed this one

Issue: Burnrate visual #464
Probably save it for next-gen

Issue: cached events are causing problems again #463
Looks like Bob self-assigned this, will see if he fixed it. Otherwise it seems like a lot of new users will be creating spurious events and then deleting them, so will need to see what actually happens when the cache holds onto a deleted event. If it doesn't allow deleted events to be referenced in other objects it's probably not that bad. Also I haven't seen any custom cache code, so a fix might mean hacking django.

Issue: Process logging - display Type of work description #461
Seems doable and will keep things moving along. Will implement in JS with type descriptions provided & mapped through template.

March 25, 2018 0.52 Time - Hours Done by davidh

Implementing a test of my editable table in agent_associations.html (has associations only, not is associations yet)
Probably shouldn't continue until this is verified to work

Committing

March 25, 2018 1.65 Time - Hours Done by davidh

fixing a minor bug in chair_tag.py
beginning to convert tables with inline form controls to data tables with modal dialogs for editing.
starting with all_contributions.html
actually that needed types only; no form controls live in the table after all.
same for bucket_filter.html
cash_report.html looks fine too

change_pattern.html: examined what was going on in the view and forms, determined it was safe to remove the table entirely
added types to demand.html, determined that nested forms are fine

distribution_logging.html: reviewed nested forms, looks okay to me

added type_agent_association to types.py as "agent association" (type_agent_association_type is currently "agent relationship")

trying out the table fix in agent_associations.html; not totally sure it will work without modifying the view significantly, as the rows (associations) are not accessible to the template. Will probably need to add some JS to update the table after modification. Need to look into Django details to see if there is an easier way.

March 24, 2018 0.50 Time - Hours Done by davidh

Created templatetags/form_dialog.py and templates/valueaccounting/_form_dialog.html
to hasten and simplify modal dialog construction for new interfaces

March 23, 2018 5.20 Time - Hours Done by davidh

Add types to process_oriented_logging.html

In site_base.html, added a div.toolbar css style that will prefer to break up unrelated tools between lines before related tools. Will probably require some implementation work in other places, but I know this will help in process_oriented_logging.html

best practices work in process_oriented_logging.html (favor contextually relevant elements to <br/>)
also converted some default field renderings to field_as_p and some manual table renderings to form.as_ul

add types to process_selections.html
add types to process.html
fixed a wacky case of {{ resource.unit_ofFtake_quantity }}, replaced with {{ resource.unit_of_quantity }}

add types to resource_facets.html
tables may be the easiest way to construct an interface for this, but that doesn't make it right or good for small screens. Will need a total re-work.
drew up some mockups, but need to evaluate usage, e.g. who uses this view anyway (anyone?) and what does the workflow look like? Are there, in practice, only a few sorts that are commonly used? Would it be more convenient to change a resource type's facet values by other interfaces if that was the task, and if so, what tasks am I missing?

resource_flow_report.html has more internal structure than I like to see in a table, but it's pretty much legit.

resource_flow.html is a little mysterious (4 ways to frame a receipt?) but now it doesn't feature tables.

resource_type_list.html needed to research what forms were involved, but ended up replacing the table renderings with .as_ul default renderings

resource_type_lists.html needed types

resource_type.html needed types, table formset renderings changed to .as_ul default renderings
resource_types.html needed same

resource.html needed types, chair tag

start.html, no, this is not happening in a table. It seems like a good place to do the "dashboard" interface Tiberius talked about, so I'm not scrapping the whole thing just yet. Rather put some thought into what this would look like ideally.

supply.html needed types
test_patterns.html needed types

today.html, again, not what a table is for, but too complicated to replace or throw out right away. will revisit.

unscheduled_time_contributions.html again has a table; will look at the view function to see if it's really tabular data. There is some JS calculating the total hours for the table, so make sure the function is replaced. Will revisit.

work.html yet again, I will need to redesign the interface with all things related to this "todo" function. Will revisit.

workbook.html added types, fixed several JS errors.

That wraps it up for all the easy mobile UI work. Everything else is a serious redesign or entirely new content.

March 22, 2018 6.05 Time - Hours Done by davidh

Adding type tags to exchange_logging.html
fixing sloppy markup
replaced <tr><td> elements outside of a <table> with <ul><li> list
separating some forms out into _add_xfer_form.html and _commit_form.html
both need sweeping changes to adhere to best practices, remove inappropriate tables, use type tags
both appear several times in exchange_logging
created additional tags in chair_tag.html for displaying best-practice form fields: field_as_div, field_as_p, field_as_li
this still needs work to get it totally consistent with the rest of the UI, but I need to get my eyes away from it before they melt
moving on for now

adding type tags to exchange_types.html
removed inline styles from finished_processes.html
type tags to internal_exchanges.html
type tags to inventory.html

added type tags to log_past_work.html
moved input control inside its label in absence of input id
tried removing table behavior of context variable forms using form.as_p, form.as_ul, and form|as_bootstrap

removed another facet table form from log_simple.html using .as_ul

added type tags to maintain_patterns.html
type tags to network.html
I bet all of these visualizations are going to choke on mobile, but I need to study the libraries in detail to know if I can remedy.

Checked out order_graph.html, and this is really going to be hurting on a small screen. Will look into the fractalDom library, but all these numeric literals are always going to bite you.

removed form tables from order_schedule.html
removed form tables in orders.html
added types to plan_from_recipe.html
added types to plan_from_rt_recipe.html

March 21, 2018 4.13 Time - Hours Done by davidh

Evaluated td elements in agents.html; no elements match the queries, so I'm going to go ahead and remove the table

all_contributions.html table is a real data table; nothing to be done for mobile users
I could turn the real data tables into ul li structures, but this is considered harmful.
same for bucket_filter.html
same for cash_flow.html

created valueaccounting/templatetags/types.py
declared assignment tags to allow model type names appearing in the UI to be changed at any time
usage:
{% type_FOO %} replaced with the name we use for FOO
{% type_FOO_type %} replaced with the name we use for FOO TYPE
{% type_FOO_type as BAR %} creates a template variable BAR whose text is the name we use for FOO TYPE
for the moment:
exchange type => exchange plan
transfer type => transfer
transfer => transfer event
event type => event
event => event record
agent association type => agent relationship
facet => quality
facet value => category
use case => usage
use case event type => use event
process type => process plan
agent resource type => agent resource association

fixed misspelling in chair_tag.py
implemented type tags in agent_type.html
type tags in agent_assoc_type.html
type tags in change_exchange_type.html
type tags in change_pattern.html, need to examine view.slots[].formset and view.slots[].formset.management_form to see if it can be removed from a table.
type tags in change_rand.html

committing

type tags in cleanup_resource_types.html
type tags in cleanup_work_resource_types.html
morally wrong tables found in create_distribution_using_value_equation.html, but I have to look at view.header_form before removing them.
type tags in create_order.html. Possibly wrong table, need to look at view.item_forms[]
type tags in create_process.html
type tags in create_rand.html
type tags in demand_exchanges.html
demand.html has a fishy view variable, view.nav_form.exchange_type, but no type names in html
distribution_logging.html has many nested forms from the view, but contains nothing directly offending

committing

breaking to learn from Bob momentarily

March 21, 2018 0.88 Time - Hours Done by davidh

Picking up with edit_stream_recipe.html
adding type tags for process type
adding classes for logical-only divs (inline styles considered harmful)

removed inline styles from divs in edit_value_equation.html; table is an actual data table.

removed inline styles from divs in edit_xbill.html
added type tags
I am almost certain the table of facets would be better as a list, but the contents of the forms live in view.nodes[].xbill_object.xbill_consumable_rt_facet_formset[]
another in view.nodes[].xbill_usable_rt_facet_formset[]
another in view.nodes[].xbill_citable_rt_facet_formset[]

event_history.html; fixed some bad markup

next up is exchange_logging, which is huge. Fresh start tomorrow.

committing

March 20, 2018 3.68 Time - Hours Done by davidh

Verified that all templates use <meta name="viewport" content="width=device-width, initial-scale=1"> for mobile scaling
checking for bootstrap container classes: .container and .container-fluid
making a CSS style for inline divs (div with style attribute is considered harmful)

checking out pages on my phone
/agents/ ok
/projects/ could use some work at the top (overflow)
/all-contributions/ horrendous table
/project-network/ graph nodes have too many line breaks
/cash-report/ detail report has too many td
/value-equations/ ok
/edit-value-equation/#/ head could use work at top (overflow)
/value-equation-sandbox/#/ looks good except for head

patterns emerging: page links along top and in buttons within lists need to wrap as an element. Tables, while probably hopeless for mobile, are too wide. Consider not using tables except where needed to cut and paste to excel or google docs.

extended the inline block class to legend > a, which covers all of the messy-looking overflows at the tops of pages.

replaced pointless table in agent_assoc_type.html
replaced pointless table in agent_association.html
can't remove table from agent_associations.html
table in agent_contributions.html probably looks terrible, but can't remove it right now
agent_stats.html: I don't like div#chart_div with inline style, but it's managed by a google lib, so changing it would have unpredictable effects. Almost definitely won't look right on mobile
agent_type.html: another silly table. Fixing.
created templatetags/chair_tag.py to register a template tag, "chair" to simplify removal of tables
created templates/chair.html as a template to simplify removal of tables
put chairs in agent_value_accounting.html

committing files

more tables in agent.html, but there is JS referring to some td elements, will have to go over it in detail to see if the table can go.

March 20, 2018 0.00 Time - Hours Done by davidh
March 19, 2018 6.42 Time - Hours Done by davidh

Looking for opportunities to filter or create defaults using transfer types in valuenetwork/valueaccounting/views.py functions:
exchange_events_csv()
fixed a potential bug that would cause a crash if events were deleted or changed
no UI for this, moving on

exchange_logging()
fixed potential bug that would cause a crash if agents were deleted or changed
fixed potential security flaw by requiring a valid login to post changes to an exchange
modified valuenetwork/valueaccounting/models.py to arrange transfers within a "slot" (transfer type in an exchange) would be sorted by date
all the filters and defaults seem to be working

change_exchange_type()
can't add any more defaults or filters

calling issue: Transfer Types should be able to configure more defaults... #495 closed

On issue: Should the resources selected in dropdowns on contributions be related to the selected context? #494
maybe, but it looks like this is already being done in many places

Evaluating issue: Validate dates past vs future on transfers and commitments #492
If it hasn't been done already, it's probably not a big problem. In order to do it in a really useful, fool-proof way, I'd have to somehow verify that a transfer took place, but there is no reasonable way to verify that a transfer HASN'T taken place. It wouldn't be that hard, however, to lock the data after the transfer date has passed. Moving on for now

Evaluating issue: Should transfer data be locked at some point? #489
An interesting question, but not vital in this release

Evaluating issue: Resource page probably needs update for exchange #488
Can't find what she's talking about on site. Digging through a small number of code points. Looks fixed to me.

Evaluating issue: Organization page error if dup agent association #482
Not a priority

Evaluating issue: Add total hours for project to agent page #481
Not a priority

issue: Orders page should not show finished processes #480
already fixed

fixed issue: Resource type should require unit #479
in valuenetwork/valueaccounting/models.py
added static method Unit.default_unit() to correspond with the DB's "Each", or if there is no "Each", it will create one
modified method ResourceType.save() so that if either .unit or .unit_of_use is blank, it will fill it with the other, or if both are blank, it will use the default.
modified every unsafe assignment of type Unit to use the default in such a way that no exception will be thrown.
this should work even on a migrated DB with blank Unit entries

issue: Resource contributions not computed correctly in flows from use events #477
I don't understand the calculation well enough to know what the output should be. Begging Bob & Lynn for help.

fixing: Fix delete value equation button on ve list #475
check for deletability is on model.
adding this check to valuenetwork/valueaccounting/views.py method delete_value_equation

issue: Re-evaluate agent type party type list #474
refactoring, not a priority

issue: Re-evaluate agent assoc type behavior list #473
refactoring, not a priority

issue: Plan Work Order on Resource page only works for workflow recipes #472
this looks like it's been fixed

issue: Project page and financial contributions - UI UX #471
still investigating

March 18, 2018 2.92 Time - Hours Done by davidh

Renovations to valuenetwork/valueaccounting/views.py function exchanges (line 10170)
This function has been gutted and rebuilt on top of itself too many times. I need to be able to read it to see what I can do about defaults & filtering.
cleaned it up, made it more pythonic, should be able to mess with the sort order, add more filtering, cluster events, etc. now if necessary
still not seeing anywhere I can add defaults using the transfer types per #495

Same treatment for function internal_exchanges.

the template (valuenetwork/templates/valueaccounting/exchanges.html) currently filters by:
- context agent matches agent in exchange (can't turn that off)
- transfers are listed ordered by date but otherwise unfiltered.
- the specific transfer to which an event is attached is not accessible.

It is now possible to reorganize the events by transfer or to filter transfers by date once the template exposes this functionality

March 16, 2018 0.97 Time - Hours Done by davidh

Petitioned Bob and Lynn for additional details on issues:
the fixture help.json has obsolete homepage image map code and the help sucks #498
Exchange shows previous list of suppliers #499
Both issues are worth fixing

Evaluated issue: Get rid of old stuff prior to new exchange code #497
Code cleanup and refactoring, not a priority

Started investigating issue: Transfer Types should be able to configure more defaults... #495
Important UI/UX issue. Fixing.
Need to gather information about transfer types and their relationship to exchange types to determine what the default values should be.

March 16, 2018 4.00 Time - Hours Done by davidh

Fixed Issue: Create order blows up, unclear condition #510
in valueaccounting/views.py: in create_order() added an additional check on form validity that takes the item forms' validity into account.
in valueaccounting/forms.py: to OrderItemForm.quantity, changed required=False to default="1.0" and added a MinValueValidator.
in valueaccounting/tests/test_orders.py: to class OrderTest, added method test_order_validation to ensure that order quantities of 0 were not ordered and that no exception was raised.
committed fix.

Resuming work on UI/UX issue: Transfer Types should be able to configure more defaults... #495
Identifying usage of transfer type in valueaccounting/views.py:

create_order()
no opportunity to add defaults as far as I can tell

add_transfer()
transfer_from_commitment()
add_transfer_commitment()
change_transfer_events()
change_transfer_commitments()
exchanges()
internal_exchanges()
demand_exchanges()
exchange_events_csv()
exchange_logging()
change_exchange_type()
add_transfer_type()
change_transfer_type()
delete_transfer_type()

March 15, 2018 0.55 Time - Hours Done by davidh

Creating valuenetwork/valueaccounting/tests/transfer_test.py
writing a test class NoThrowTransferTest to ensure that the method Transfer.event_text is unable to throw an exception even if provided garbage data

March 15, 2018 0.90 Time - Hours Done by davidh

Fixing issue: Bug in exchange page #511
Determined that the bug is likely fixed but unclosed as an issue.
Adding a test case that attempts to reproduce the error anyway.

March 15, 2018 2.40 Time - Hours Done by davidh

Resuming work on test cases for issue #511
finished valuenetwork/valueaccounting/tests/test_transfer.py
appended module import to valuenetwork/valueaccounting/tests/__init__.py

Adding tests to verify that bugs I resolved yesterday (3/14/18) are fixed
added valuenetwork/valueaccounting/tests/test_resource_type.py to test fix of issue: Create resource popup shouldn't have quantity #512
added module import to valuenetwork/valueaccounting/tests/__init__.py

Laptop is running extremely slowly, will resume and push when resolved

March 15, 2018 1.72 Time - Hours Done by davidh

Evaluated issue: Let's internalize notification #501
Refactoring request, not a priority

Evaluated issue: When distribute part of a receipt, don't get the partial field back #500
Need more information re: where this occurs, but should fix

Evaluated and researched issue: Exchange shows previous list of suppliers #499
Clearly impacts usability. Source not yet found.

Committed tests

March 14, 2018 1.93 Time - Hours Done by davidh

fixing issue: Create resource popup shouldn't have quantity #512
in valuenetwork/valueaccounting/forms.py line 285: added class CreateUnquantifiedResourceForm(CreateEconomicResourceForm) with 'quantity' added to Meta.exclude and overridden class property quantity = None
in valuenetwork/valueaccounting/views.py line 994: changed variable create_form to use the new class

re issue: Bug in exchange page #511
Bob claims Freedom Coop version has this fixed; solicited him for a link so that I can check out the files

evaluated issue: hyperlinks to resources from location page #505
feature request, not a priority

evaluated issue: improving support for Transportation (process) #504
cool idea, but feature request, not a priority

evaluated issue: Transfers between affiliates' virtual accounts #503
cool idea for next gen. feature request, not a priority

fixing issue: NRP front page #502
seems easy and useful enough to consider it a UI/UX improvement for this revision. Tracking down the template.
in valuenetwork/templates/_work_panel.html line 23: changed item.description to item.process.timeline_description

issue: Delete warning popup #513
needs a fix for user-proofing. Will do once I understand the client side javascript they have going a little better.

Work - Outreach-Marketing: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Meeting: 1.00 Time - Hours due March 14, 2018
Unassigned
Work events:
March 19, 2018 2.50 Time - Hours Done by davidh

workparty with Tibi on installing a new instance of the NRP for the Verdun project. we worked on webfaction.com, Github and exchanged about the work to be done.

March 19, 2018 2.50 Time - Hours Done by Tibi

workparty with David on installing a new instance of the NRP for the Verdun project. we worked on webfaction.com, Github and exchanged about the work to be done.

Work - Demo: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Training others: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Documenting: 1.00 Time - Hours due March 14, 2018
Unassigned
Work events:
May 14, 2018 2.55 Time - Hours Done by davidh

Filling in the NRP-CAS dictionary file with some skeleton explanation and a table of terms as they are now.

April 4, 2018 2.15 Time - Hours Done by davidh

Creating a hacks/readme.md in the repo in case anyone else needs to install this thing.
Also refactored hacks for reuse a bit and committed.

Work - Analysis and Strategy: 1.00 Time - Hours due March 14, 2018
Unassigned
Work - Shopping: 1.00 Time - Hours due March 14, 2018
Unassigned

Process context:

Pattern: Infrastructure virtual dev
Context: Verdun
Order: Work order 270 , Create new classical NRP for the Vedun project due: 2018-03-31

Previous processes:

Next processes:


Process notes:

Process used mostly by David and Tibi to set up a new NRP instance for the Verdun project.

Project Folder
https://drive.google.com/open?id=0BzrQyEif2HItUGVNYmprTWJwUWs