Tuesday, January 3, 2017

Change Log: 2.0.112 - Anniversary Release!

Alright, so this is the big one: the much ballyhooed "Anniversary Release" has finally arrived! The production version of the Manager is officially version two!

Before I get into the details, I would like to apologize to anyone who walked in on me while I was rolling it out: in spite of all of my preparations, the deployment was a major faceplant/debacle and I saw, in the logs, a couple of people log in and hit major errors.

I am really sorry about that!

Release 2.0.112 contains all of the following:
  • a complete, front- and back-end rewrite of the Settlement Sheet!
  • all new Timeline display and controls that are both touch-friendly and do not require page refreshes! 
  • relocation of the the timeline controls from the Settlement Sheet to the sidenav/burger: the settlement timeline may now be accessed from any view by all players!
  • the all new Campaign Notes feature, which replaces Settlement Sheet notes and is accessible by all players in the campaign!
  • total deprecation of the Settlement Event Log!
Initially I was planning on doing all of this a.) in bits and pieces and b.) much later in the Campaign Summary refactor milestone, but as I was sizing up the feature list for the milestone as a whole, I figured I should probably do all of this major stuff first, and then give myself plenty of time to fix all of the issues that releasing these features will inevitably introduce (e.g. while I work through the rest of the feature list).

Basically, I decided that I want to rip all the stuffing out and then fix all the broken bits as I go, rather than delivering a bunch of features and then having to go back and double-check them all in the wake of the massive upheaval that would be caused by introducing these major revisions later.

At any rate, 2.0.112 is not only a major milestone, but it represents a totally new direction for the Manager. In a nutshell, the new philosophy, which is based on all the implicit and explicit user feedback I've gotten over the last six months, is this:

  1. Pay more attention to presentation and aesthetics. You all have spoken and I am accepting the criticism. 
  2. Require fewer page reloads/refreshes.
  3. Implement more and better multiplayer support.

The new timeline controls are also a big step in the direction of directly addressing the multiplayer issue. I've been sort of dancing around it for the last six months, but the new timeline--which shows the event log lines alongside the timeline events--is meant to help non-admins see what's going on, w/r/t automation and general behind-the-scenes settlement business.

The Campaign Notes feature is also a direct response to a lot of the multiplayer requests I've gotten over the last year. I'm not really sure it'll do everything everyone has asked for in its current form, but I think it's a good start and I definitely intend to build it out, revise it, etc.

Finally, for those of you who notice its absence, the "Export to XLS" feature has been disabled temporarily. Release 2.0.112 revises most of the back-end data model, and the feature is currently totally broken as a result. I'll be working on repairing, revising and relaunching it during January/February.

Thanks for using the Manager!

Corrections and Fixes

  • Spent about three hours chasing down a race-conditon bug where daemonizing the server could sometimes happen so fast that the server didn't have access to its port.
  • Fixed a bug where None type events in the timeline caused a traceback to be thrown when rendering settlement timelines on the Settlement Sheet. -third_revision
  • Monkey-patched a bunch of Survivor Search bugs having to do with apostrophes and other characters in epithets, survivor notes, etc.
  • Survivor Search no longer shows retired survivors. -kkanable
  • Corrected some typos in the flavor text for the "Seizures" disorder.
  • Fixed a bug where adding a custom nemesis monster to a settlement coul cause tracebacks on Settlement Sheet load (if the nemesis wasn't actually a nemesis in game_assets.py).
  • Addressed a presentation problem where the top nav bar had a tiny gap at the top of tablet resolution. (I feel like I worked on this before...not sure how I broke it again.)
  • Fixed a bunch of tablet resolution increment/decrement buttons where the height of the button element was inheriting from...who knows where...and causing the text to fall off of the button
  • The "Saved" pop-up no longer blocks control elements at tablet resolution
  • Addressed an error where attempting to submit blank attribute values for user assets would flash the "Saved" pop-up; now you get a hostile little javascript alert when you try to save a blank value.
  • Fixed an issue where the "Saved" pop-up could sometimes appear "under" (i.e. and be invisible) certain modal overlays.
  • Settlement storage is saved following item normalization now to prevent extraneous/duplicative storage item normalization runs.
  • Fixed a bug where "Edged Tonometry" milestone controls sometimes wouldn't show up in PotSun campaign Settlement Sheets
  • Survivors are no longer loaded or normalized on Settlement Sheet load (should help with page load times).
  • Corrected a presentation issue affecting Firefox at desktop resolution where dashboard buttons had no margins (and had overlapping borders).
  • Fixed a performance bug where pages were rendered (just for fun!) and never returned in "nofrefresh" type requests to index. Also removed some redundant settlement initialization operations happening in "norefresh" type updates.
  • Corrected the spelling of "The Dragon's Tomb" SE.
  • Fixed a problem with the "Dragon Iron" Dragon King resource that threw tracebacks on Settlement Sheet load. -Ezekiel2703
  • Removed some vestigial angularjs code from the big container div used on all pages: should stop that random ng-init missing function error from showing up in the console if nothing else.
  • Fixed a bug where the "saved" dialog/popup thing wasn't rendered with the Dashboard
  • The "new_settlement" view now has a burger button and will let you navigate back to the dashboard (so you're not stuck there forever).
  • Refreshing the admin panel no longer calls assets.Settlement.update_mins(), which should save us a ton of wasted CPU cycles.
  • Fixed a bug where modal overlays could sometimes be taller than the viewport due to the height of the background ("underlay") content. Overlays should always be fully visible at all resolutions now.
  • Manhunter showdowns in LY 10, 16 and 22 are now added to the timline correctly (i.e. as Special Showdown type events, rather than Nemesis Encounters)
  • Corrected the Lion Knight timeline events to include special showdowns. The Lion Knight is no longer selectable as a Nemesis.
  • Corrected the Manhunter expansion dictionary to include a special showdown for the Manhunter in LY 5.
  • The Skyreef Sanctuary location is no longer added to the locations options as if it were a consequence of adding "The Sun" location.
  • Fixed a bug where survivors with "Noble" or "Reincarnated" surnames who had NOT checked the box on the Survivor Sheet did not display their Dragon Traits/constellation table correctly.
  • API: survivors are serialized as proper JSON now, rather than hybrid/homebrew, when serialized using their own methods or as part of a serialized settlement. Removed some redundant/vestigial code in V1 that worked around this error.
  • API: using the /settlement/<action>/<settlement_id> route with a non-existent settlement ID returns a 404 now instead of a 500

Important! Going forward, in order to keep these change logs readable/referenceable, I will be splitting the up the "Improvements" headings to reflect whether their items affect the application or the API side of the Manager.

Application Improvements

  • Cleaned up the dev blog, lost the three-color lantern logo and published the "About" page, including full credits and acknowledgements.
  • Response time records now auto-prune (records more than seven days old are purged on update).
  • Server request logging is disabled. It's basically useless for troubleshooting and I can't remember the last time I looked at production server logs.
  • Starting the V1 app server now removes all existing sessions (should minimize bogus tracebacks on deploy).
  • Touched up server.py so init errors are raised as well as logged
  • Tuned up server.py a bit to log more specific info about initialization and shutdown. 
  • The Event Log view has been totally deprecated; all links have been removed and the methods of assets.Settlement and html.py have been banished to the land of wind and ghosts
  • Rewrote the new user asset forms to use angular styles and KD checkboxes.
  • Made a handful of updates to the survivor Search feature:
    • Revised Survivor Search to use survivor JSON from the API representation of the settlement (which is loaded in via XHR promise in the angularjs app) and deprecated the assets.Settlement.get_survivors() code that hacked around that previously.
    • Revised Survivor Search presentation to show more survivors on the screen at all break points (even mobile + keyboard up).
    • Survivor Search now only shows survivor attributes that are not blank/null and also includes survivor base attributes as well as Courage, hunt XP and Understanding. -kkanable
  • Deprecated literally hundreds of lines of HTML rendering code from assets.py. I feel 10 lbs lighter.
  • Deprecated the "onload" javascript operations from the head element of the template HTML once and for all. Should help client-side render times a bit.
  • The "new_survivor" view is deprecated! New Survivor controls have been rewritten as an AngularJS app and are now an overlay of the campaign/settlement/survivor views. Hooray!
  • Improved Dashabord -> System controls and presentation:
    • Dashboard user preference update no longer refresh the dashboard or require the use of a save button.
    • Deprecated the user preference for comma-delimited game assets on the Settlement Sheet and the Campaign Summary (because it was against the new design of the Settlement Sheet and because no one was using it).
    • Rewrote the Dashboard "System" panel to use KD checkboxes
  • Added MiracleWorker/HighImpactBoobs kdm-font-2 to available fonts.
  • Added support for the "Metrophobic" font, which is similar to the "Amplitude Wide Book" font used on KD cards. (I was going to license "Amplitude Wide Book", but the publisher, Font Bureau, wanted like, $4000k or something totally insane).
  • Restyled the "Saved" dialog to look more KD-ish.
  • The "Cannot Use Fighting Arts" block no longer pushes the "Fighting Arts" header to the left on the Survivor Sheet.
  • Revised the assets.User.is_settlement_admin() method to support 'truthy' string output in addition to good, old fashioned Python bool type objects.
  • Deprecated the dynamic button placement JS on the Survivor Sheet in favor of a single presentation method for all sheets.
  • Restyled the expansion-specific survivor sheet attributes to use KD style checkboxes instead of whatever the hell I thought I was doing before.
  • Updated the dashboard "asset_link" buttons for direct Settlement Sheet access to include the created date, expansions and campaign info for the settlement.
  • Campaign summary endeavor Token management now uses the angularjs application scope vars to determine whether controls are accessible, etc.
  • Revised Campaign Summary Endeavor Token management to be more minimalistic, in terms of UI/UX
  • The Settlement Sheet has been completely rewritten from the ground up to be an AngularJS application powered by API calls. For now, only some of the controls get data from the API and most of the writes back to the database are handled by HTML form submissions (some still requiring a page reload), but eventually, everything will be handled asynchronously.
  • Refactored the layout of the Settlement Sheet to look more like the in-box settlement sheet, including the following:
    • placed the crossed "Nemesis Encounter" swords next to the "Nemesis Monsters" headline
    • completely tore down and rebuilt Locations and Innovations controls to do all presentation in HTML + angular.js (page reloads are still required here, for now).
    • got rid of the borders around Settlement Sheet controls
    • normalized headlines to look more like the in-box sheet
    • replaced bullets with filled and empty squares
    • innovation deck is now in columns and appears within a box, for ease of visual reference and to save a little space on the screen
    • Evened out the two main "columns" of the Settlement Sheet at tablet resolution
    • Restyled Settlement Sheet buttons to arrange horizontally at tablet resolution
    • deprecated the use of HR elements to break up the Settlement Sheet and Campaign Summary at tablet and desktop resolution. HRs are  still kind of necessary at mobile, but 86'd a bunch of those as well.
    • swapped out +/- on the increment/decrement paddles in favor of &#9652; and &#9662; up/down arrow elements
    • the "add item to storage" button is no longer gigantic at tablet/wide resolution
  • Touched up the controls for managing Departing Survivors to use 'kd_alert' and 'red_glow' style; removed the random HR element.
  • Removing settlement locations and innovations is now logged (and recorded in the settlement's event log).
  • Redesigned the "right pane" of the Survivor Sheet to conserve space at tablet and desktop resolution.
  • Game assets on the Settlement Sheet may now be moved with a tap/click and no longer trigger a page reload. I also deprecated the drop-down controls for removing game assets from the settlement (which should help page render times ever-so-slightly)
  • Settlement Sheet controls for Lost Settlements have been completely overhauled:
    • Changing the number of Lost Settlements on the Settlement Sheet no longer refreshes the view
    • Settlement Sheet reference info for "Lost Settlements" is now contained in a CSS tooltip at all views (in order to minimize visual clutter: look at me, ma--I'm a designer!).
    • Wrote an angularjs controller/app to do responsive, checkbox-based controls for Lost Settlements on the Settlement Sheet. I'm pretty proud of this: I'm starting to feel like I'm finally turning a corner on this javascript thing.
    • Redid the presentation text on Lost Settlements references to include the checked boxes, rather than the text I wrote to hold the spot originally.
  • Milestone story events may now be toggled without a Settlement Sheet refresh. I also rewrote asset.Settlement.update_milestones() to no longer do HTML form hacks. Woohoo! Get deprecated!
  • Survivor Sheet cursed item controls now get their data from the API rather than from the python app. Methods for rendering cursed item HTML in assets.Survivor and html.py have been deprecated.
  • Created the new "Campaign Notes" feature, which allows all players in a campaign to mark up a central/shared "notes" interface. This replaces settlement notes, which will now vanish without a trace.
  • While refactoring the Settlement Sheet to be more open and look more like the in-box sheet, I also decided to reverse/undo my design where controls became available on the form as needed. Consequently, all milestones and principles available to a campaign are always available on the sheet.
  • Keyed in a bunch of random settlement and survivor names (it's starting to feel really random!)
  • Added assets.Settlement.get_event() to retrieve event dictionaries from the settlement's API asset. Subbed the method in for old references to game_assets.story_events, etc.
  • Improved api.py to use a new setting from settings.cfg for better API URL setting.
  • Streamlined the kdmManager.js app based on some Google recommendations:
    • Removed the "global" angularjs controller logic (evidently that's a bad design pattern) and moved its methods out into the non-scoped space of the JS application. I think the big idea will be to have kdm-manager.js be all of the global/general-use/convenience stuff and then each view that requires specialized applications will have its own file. I therefore moved the settlement sheet app into a separate file and namespace (and will do the same with the Survivor Sheet and Campaign Summary view, at some point).
    • Inline scripting to register modal divs to their opener buttons now happens "below the fold", i.e. after the HTML loads.
  • Completely banished and annihilated all code within the assets.py and utils.py modules that produces JS objects or pseudo-JSON strings used to hot-wire AngularJS apps using ng-init.
  • Created a whole new Timeline management application and 86'd the old one:
    • Deprecated assets.Settlement.get_timeline() method.
    • Removed all references to assets.Settlement.update_timeline() from the V1 app. It's a new day!
    • Deprecated assets.Settlement.update_timeline() and added two interim/support methods to assets.Settlementadd_timeline_event() and rm_timeline_event(). These are basically wrappers for API operations and will only continue to exist as long as we still create settlements in the V1 app.
  • The error-reporting modal is no longer tied to the burger and is printed on all HTML (i.e. in case we need to expose it from any view, etc.)
  • Touched up the presentation on the error reporting controls at all breakpoints for clarity and to look more KD-ish.
  • Improved New Settlement creation presentation and back-end:
    • Redesigned, refactored and basically reimplemented the "new_settlement" view to use API data. Man--what a trash-pile: that piece of garbage was probably the oldest living piece of the application still in production (until now).
    • Shit-canned the HTML checkbox rendering methods in html.settlement. Feels great. This doesn't deserve its own bullet (the above bullet really captures it more than adequately), but I'm on a natural high about killing those methods off once and for good. 
  • Burger/sidenav has a wider "open" width (which should help with longer strings breaking its boundary).
  • New settlements are now created with an "admins" key (i.e. a list with the settlement creator's email in it). The API normalizes this in, but why spend cycles there, when we can just do it up front?
  • Loading the dashboard no longer updates settlement minimums. We've got the API normalizing now, and we're going to switch to API-based dashboard content real soon, so it's time to stop leaning on the V1 app for normalization. Should also help dashboard load times.
  • Moved bulk add survivor controls to the burger/sidenav. They are now always accessible for Settlement Admins, which is nice.
  • Redesigned player management:
    • Moved player management controls to the burger/sidenav
    • Re-implemented player management controls as a nice little angularJS app that shows changes immediately and is only visible to admins.
    • Deprecated the old assets.Settlement.update_admins() method (which actually had a pretty major bug that I guess was lying dormant for the last year) and replaced it with a toggle method.
  • Moved all z-index CSS into /media/z-index.css and removed all z-index params from /media/style.css. Also removed a bunch of broken/redundant z-index selectors.
  • Deprecated collapsing_block_groupfloating_event_log and floating_asset_button code from assets.py and /media/style.css.
  • Fixed a handful of selector precedence issues that previously required the !important flag to workaround.
  • The "Manage Departing Survivors" button now has a nice gradient background based on KD Hunt Event cards.
  • Deprecated admin.valkyrie() and all references in assets.py to the mdb.the_dead collection.
  • Drastically revised the assets.Survivor.death() method to remove all settlement modification operations. File this under, "settlements need to start self-normalizing."
  • Survivor deaths are now logged in the settlement Event Log, along with cause of death (if available).
  • Settlement Event Log events now support an "event_type" attribute, which has no actual uses yet, but will be used in the future to improve log display, etc.
  • Added a nice fade-in effect with a spinner to hide controls while pages render.
  • Survivor Sheet avatars have a 'max-height' attrib now, so there should be fewer resize super-deformations now.

API Improvements

  • Campaign notes are now included in serialized settlement objects as part of the "sheet".
  • The API now includes both the campaign definition and available principles (under "game_assets") when it serializes a settlement
  • Updated the API to use the new SotF rules
  • Settlement normalization now creates the "admins" key (list of admin emails) for any settlement it loads that hasn't got the key. Same-same for "expansions" (you get a blank list if you haven't got the key: this is hardcore legacy support, but FIWE, it was easy to implement.)
  • Moved the PotStars campaign asset into the V2 assets.
  • Created a new route: /settlement/event_log/<settlement_id> now gets a settlement's event log as a monster JSON object.
  • Created a new action along the settlement route called 'set' that allows the settlement sheet to be set from a dictionary (i.e. JSON); created a method (models.settlements.update_sheet_from_dict() is the name) that processes such dictionaries.
  • Moved Story Event assets from V1 game_assets.py to API assets.
  • Created Story Event and Settlement Event assets and models in V2.
  • Settlement objects are now serialized to include Settlement and Story Event references in game_assets.
  • Settlement objects are now serialized to include available monster assets (under game_assets). 
  • Settlement objects are now serialized to include available innovations (including principles) under game_assets; the principles dictionary in assets/innovations.py has been improved to include all Settlement Sheet data/attribs, e.g. mutually exclusive options, etc. A serialized settlement's "campaign" now only includes principle handles.
  • Settlement objects are now serialized to include their operative expansion definitions under game_assets.
  • Settlement "game_assets" campaign definition now includes whether the campaign uses saviors and dragon traits.
  • Added new methods to models/survivors.py to a.) get the survivor's effective sex and b.) render a bool re: whether or not they may be nominated for intimacy. Effective sex is now serialized as part of the survivor sheet.
  • Settlement objects are now serialized to include a game_assets object called "eligible_parents", which indicates all survivors in the settlement capable of being nominated for Intimacy.
  • Survivors are now initialized with a Settlement object (and a little 's' settlement dict), for laziness/DRYness purposes.
  • Updated the Models.py base class UserAsset to include a log_event() method that basically works the same way as the V1 equivalent, except for the fact that any initialized user asset may now log a settlement event without calling the settlement objects methods (because I'm lazy af).
  • Survivors are now serialized along with their notes; the notes are represented as an attribute of their sheet.
  • Created a method for saving user assets (survivors, settlements) to their respective MDB collections in Models.py. Updated the __repr__ for user assets to be more descriptive as well.
  • Settlements are now serialized with a game_assets element called "abilties_and_impairments" that contains all A&Is accessible to the settlement.
  • Created a new GET route in the API called /new_settlement that retrieves assets necessary to create a new settlement.
  • Legacy "settlement_notes" are converted to mdb.settlement_notes documents upon migration!
  • New timeline application support:
    • Created a method to convert timelines from the old, pseudo-JSON to fully-compatible-with-JS type JSON.
    • Added a new POST route (/settlement/add_note/<settlement_id> and /settlement/rm_note/<settlement_id>) that allow campaign notes to be posted to and removed from the MDB via API call. The route supports CORS.
    • Keyed in Lion Knight, Lion God, Gorm and DBK story event references (for timeline use).
    • Timeline migration has quite a bit of custom code re: un-fucking legacy timelines with custom events, etc. Most legacy data can be salvaged. Migrated timelines are also force-sorted to be real-deal JSON where list order is significant, etc.
    • Added a pair of new POST routes (actions: add_timeline_event, rm_timeline_event) that allow timeline events to be added and removed from a v1.1 (or higher) settlement timeline. These also support CORS/preflight/etc.
    • Keyed in all story event assets and settlement event assets.
  • Created a routes/settlement.py module to manage settlement operations more cleanly.
  • Monster assets are now initialized with the "levels" key/value pair as part of their asset (and monster.Monster objects get a "levels" attribute). This is always an int.
  • Migrated locations from V1 to API assets. Cleaned up all location definitions and broke up the three types of locations into three asset dictionaries.
  • Monster objects now have methods to tell their selectability/uniquness/etc., such as is_unique(), is_selectable(), etc.
  • Settlements are now serialized with a game_assets element called "principles_options" that basically powers the little mini-form on the settlement sheet.


  1. Perfect timing. Our group will give it a speed run tomorrow. Looking good so far!

    1. Nice!

      If you don't mind, send along whatever you notice, no matter how small: pretty much everything is new/updated/changed...so everything is up for grabs.