-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Ok, here's a real-world problem similar to a JavaBat:
We are using the Liquid templating language to pull author information based on key/value pairs. The new_post.rb should offer a list of potential authors based on any of the active school_year values. If this value matches the school_year variable in the _config.yml, then you should put each of the key pairs found as potential authors, and assign a number to each author based on the order returned.
For example, if the current school year is 2015, then...
- Look for all of the officer keys with an active school_year value of 2015. Note that the officer may have multiple active
school_years, so iterate through all of them. - Populate an array with each of the officer keys where the current school year is equal to one of the
school_years in the officer data. - Prompt the user to enter a value for the author. No author wants to be the value 0, so you'll have to shift the index by 1.
- A user can enter multiple authors by typing multiple numbers. While the number is not equal to 0, that is, no author, continuously prompt the user to enter another author. If the user enters an invalid number, then do not parse that number and instead prompt the user to enter a correct prompt.
- If the user enters 0 as the first value, assume that the post has no author.
To convert the YAML format into something Ruby-friendly, this Stack Overflow answer may help:
Ref. #16
Reactions are currently unavailable