资源说明:
Problem Description Below Requirements The "Part II" release moves entirely to ActiveScaffold layouts. This code was developed on Mac OS X using, Ruby 1.8.6, Rails 2.2.2, and Sqlite 3.4.0. I have not knowingly used any other gem dependencies for the required portions of this problem, although there is ActiveScaffold used for the Vendor controllers and view. In addition, the code uses the dig command to determine whether a url belongs to a valid domain. This command is assume to be in the path. DiG version 9.4.2-P2 was used in testing, but any version that accepts the '+short' option ought to work. Tests will pass falsely and fail erratically without an Internet connnection. Open Issues Code does not validate that a CAS # corresponds to an existing compound. Code does not validate units. All uses or any chemical are assumed to be using the same units. The amounts are Integers. It is possible to create multiple scheduled uses for a single chemical. Current amounts will be correct, but forecasts of future consumption are incorrect. Problem Description For this code problem you will build a few features for a simple Web-based chemical inventory system. Please use any OO language you are comfortable with, your favorite web framework, and some kind of Object Relational Mapper. Please include plenty of tests/specs for the domain and your controllers. Part I The features you will develop in part I: * Vendors: just preload some vendors, no need to provide an interface for adding new ones - A vendor has a name, a phone number, an email address and a website url - A vendor must have a name - A vendor must have some kind of contact info, i.e. at least one of: phone number, email, website - If the vendor has a website, it must be an HTTP URL (or something like www.google.com, which is assumed http), and the registered domain name (e.g., google.com) must exist (check via some reasonable method, doesn't have to be ironclad) - to save time, do not validate that the phone number or email is valid * Add new chemical to the inventory: provide a web interface to add a chemical - A chemical has a name, a CAS #, an amount (integer value plus a unit, like 300 mL) and a vendor - A chemical must have a name - A chemical may not have a CAS #, but if it does it should be valid, see http://www.cas.org/expertise/cascontent/registry/checkdig.html - A chemical must have an amount and unit - A chemical must have a vendor * Display a list of all chemicals in the inventory, including all the helpful information listed above (vendor contact info, etc.). A CAS number should be linked to Chempedia as in the following example for CAS number 67-68-5: http://chempedia.com/registry_numbers/67-68-5 * Delete a chemical from the inventory using AJAX Please submit your code at this point. Part II In this part you will add the ability to record uses of the chemicals by members of the lab. Please add the following features: * User records one-time use (provide a web interface) - A "one-time use" has a chemist (just a string), an amount, a chemical and a use date (all required) - When you add a one-time use, it should deduct the used amount from the amount of the chemical in the inventory * User records scheduled use - A scheduled use has the same attributes as a "one-time use", except use_date should be called start_date, and in addition it has a periodicity and an optional end_date - A schedule use's periodicity can be weekly (on a particular day of the week), monthly (on a particular day of the month), or every N business days (don't worry about dealing with holidays, just ignore weekends) - When a user adds a scheduled use, the amount displayed for a given chemical should reflect the amount after any scheduled uses that have already occurred have been deducted (for now we won't worry about scheduled uses that don't actually happen) * Forecast when chemical will run out: Display a warning on the list of chemicals, with the date the chemical will run out - If the last use brings the amount to zero, then display the date of the last use - If the last use makes the amount negative, display the date of the use previous to the last use You're done! Whew.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。