hcarter333 / ham-radio-freedom

0 stars 0 forks source link

Add ham help update page to app #13

Open hcarter333 opened 1 year ago

hcarter333 commented 1 year ago

Fix the class HamTestHelp in main.py First, remove the put in the get method to see if help will be displayed.

Then, make a UI to specify where the help pages for each questions are. The UI should also display the questions and its available answer so the user will be able to make an informed decision about which help page to link to the question, or alternatively, if no help page exists, what information to place in the newly created help page.

To see the existing page (which does not work--see below) go to https://hamdaise.wl.r.appspot.com/hamtesthelp

hcarter333 commented 1 year ago

The put wasn't the issue. The issue is that the template hhs.html doesn't exist in the current deployment, or this repository.

image

hcarter333 commented 1 year ago

The new issue is that the template tries to use: {{hh.tclass}} {{hh.q_index}} {{hh.helplink}}<br> and gets the error image

However, when the same query is run at https://console.cloud.google.com/datastore/databases/-default-/entities;kind=HamHelp;ns=__$DEFAULT$__/query/gql;gql=SELECT%2520*%2520FROM%2520HamHelp?project=hamdaise

valid results are returned: image

hcarter333 commented 1 year ago

App engine wants the query string to not contain double quotes so, 'SELECT * FROM HamHelp WHERE tclass = "T"' didn't work, but "SELECT * FROM HamHelp WHERE tclass = 'T'" did.

Then, the question index wasn't displayed becuase the template used q_index instead of qindex.

Now, the application produces: image

This is awesome, because we can use the question index to display the question and answers.... (Not from the database though, although, yeah, the questions and answers maybe always should have been in the database? Need to think about that.) by loading in the questions in the same manner they're loaded in the main page. From there, the user should use a simple, very simple, form to specify the link to the associated help page.

The page above should also be changed to produce a link to the specified help page. Also, the questions should be ordered by qindex. Missing questions should still get a form.

hcarter333 commented 1 year ago

When sorting on qindex, I get

NeedIndexError: no matching index found. recommended index is:

This is because the index.yaml file did not get upated by myself, or the app running locally (because the app is not running locally.)

I need to copy over and deploy the exisiting index.yaml file.

Very helpfully, the error message suggessts I add

image

to the index.yaml file. Trying it now.

Found this post that pointed me at what to look for: https://stackoverflow.com/questions/43275308/412-no-matching-index-found-error

hcarter333 commented 1 year ago

Updating Indexes

Had to use instructions at https://cloud.google.com/datastore/docs/tools/indexconfig#Datastore_Updating_indexes

AFTER manually updating index.yaml

ran

gcloud datastore indexes create index.yaml

To view indexes use https://console.cloud.google.com/datastore/databases/-default-/indexes?project=hamdaise

After the index updated (took a minute or two, literallly) I got image

and then on the app

image

So we got ordered output now!

hcarter333 commented 1 year ago

I'm thinking of using secrets in Google App Engine to store a 'password' for modifying help topics. If it works at all, this is the best reference I've found so far:

https://codelabs.developers.google.com/codelabs/secret-manager-python#6

hcarter333 commented 10 months ago

I looked into the general class help topics today. There are only 15 total. I'm deferring this till later as a result. I'll make a modified version of the tech_tqs.py to pull the question pool into datasette, and then perhaps start making help videos with Daize if it seems like the thing to do.