2018-07-25

Elixir Project Update 7

Welcome back! Overall I had a good week, even though my tasks don't look like it. I probably spent a few extra hours on top of what I had originally planned to working on this list. You can see the repository here, and the server here. Aight, lets get to it.

Last Week:

  • Answer Key - 1 hour
  • Put web code on Github - 15 minutes
  • Setup web server - 45 minutes
  • Research storage options - 1-2 hours
  • Return the Quiz in HTML - 2 hours
  • PDF output - 2 hours
  • Answer Key page or section - 1 hour

The farther off the beaten path the more unknowns, and time sinks I am hitting. I expected this, but it can still be a bit disheartening. This week setting up the web server was that time sink. Most of what I wanted to do was standard, and took me all of 15 minutes. For the non standard part, I sunk three or more hours into trying to figure it out. Finally I compromised, with a partial solution. 

Most tutorials assume you will deploy your web application to a root web directory. So in my case that would have been https://peelle.org/. I already have a website working there so I deployed my Elixir app to https://peelle.org/quiz/ For everything but the static assets like css files and images this worked mostly fine. 

In the router I could set /quiz/ as the root scope, and be done. Pages directed there fine, but static stuff is handled differently. I ended up manually changing some of the paths to just have /quiz/ at the front.

I think I found the correct setting to fix this, and tried multiple ways to set it properly, but was not successful. If I were a younger developer I would probably try and submit a bug report, but I'm an experienced enough programmer, and inexperienced enough Elixir programmer to know that it is much more likely I am doing something wrong.
Sorry didn't have any good code pictures.
So I picked a random one.

Also, I'm a bit too prideful/lazy so I didn't go ask for help like I should have. I made a deal with myself that I will keep trying after I get other tasks done, and if I can't figure it out before the next Elixir meetup I'll ask someone there for help.

As for returning the Quiz in HTML form, it ís not a total bust. I did manage to get it to return data and started figuring out how to play with the data. :-D What I also realized was "Return the Quiz in HTML" was not as atomic as I thought. It has several bits that need to be done to get me there.

Storage options I skimmed some stuff, but I didn't finish it up. I'll do that this week. Everything else I just didn't get to before the week was done.

This Week:
  • Finish storage research.
  • Hook quiz_generator into quiz_website.
    • Decide if this needs to be an OTP app, or just some loaded lib.
    • Determine if the returned information should be persistent, semi persistent, or transient.
  • Return a static page with the Quiz DS.
  • Style page into proper looking quiz, not just a variable dump.
  • Add the Answer DS at the bottom of the webpage.
  • Return a PDF.
  • Add some web tests.
Bonus If I have time:
  • Add authentication.
  • Using storage options, save input lists for a user.
  • Create some pages to manage this.
So this week is about putting the two "apps" together into a working useful web page. Most of my hesitation is more about how to go about that. I think that wrapping my quiz_generator in OTP is probably overkill, but it also looks like fun. :-D 

Also, for storage, I'm trying to decide do I want these quizzes to stay around at all, and if so for how long? Deciding on that could affect if I use ETS or DETS, and so on. 

So another four weeks have passed and I think I'm starting to notice a pattern. My outline, or crystal ball, starts to break down once I get past third week mark. Two weeks back deviated from the plan somewhat, and this last week deviated even more. 

I won't post another massive outline, but I'll probably show a mini road map for the last  portion of the project on the next post.