Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inspect unlinked html found in templates folder and unused/replaced files #3

Open
carlosparadis opened this issue Jul 21, 2017 · 10 comments

Comments

@carlosparadis
Copy link
Member

carlosparadis commented Jul 21, 2017

  • _formhelpers.html
  • Admin_dashboard.html
  • Devicepage.html
  • Error_deployment.html
  • Error_page.html
  • Manage_questions.html
  • survery_mode.html

Decide what to do here once the purpose for these files is clear.

@jygh98
Copy link
Member

jygh98 commented Jul 26, 2017

formhelpers.html

After further inspection of the html files, it appears that formhelpers acts as a template for question_form.html, survey_form.html, and deployment_form.html. From what it appears like it was done like this to keep the files modular and we would actually need to keep this file.

@jygh98
Copy link
Member

jygh98 commented Jul 28, 2017

admin_dashboard.html

When trying to access this web page, a build error occur

werkzeug.routing.BuildError
werkzeug.routing.BuildError: Could not build url for endpoint 'admin_landing'. Did you mean 'question_page' instead?

With a further inspection of the html file, I noticed this section

<div class="navbar-header">
	<a class="navbar-brand" href="{{ url_for('admin_landing') }}">Home</a>

you would realize we do not have a routing url 'admin_landing', but what we do have is home. So if you change the url_for to any existing routes, say home

 <div class="navbar-header">
	<a class="navbar-brand" href="{{ url_for('home') }}">Home</a>

This is the web page that appears

admin_dashboard

So it looks like this was a feature to directly add questions through the dashboard, however if I were to create a test question it would lead me to another build error

werkzeug.routing.BuildError: Could not build url for endpoint 'question_page'. Did you forget to specify values ['questionid']?

If I add some jinja logic to make use of the questionid to look like this

<div class="navbar-header">
	{% for question in questions %}
	<a class="navbar-brand" href="{{ url_for('question_page', questionid=question.question_id) }}">Home</a>
        {% endfor %}
</div>

Also it looks like admin_dashboard makes use of the questionform, I am not completely sure how it works but if I were to link the action to /questionform

<form id="questionForm" name="questionForm" action="/questionform" method="POST" class="form-horizontal" onSubmit="validateForm()">

It will actually create questions, although i still have to figure out why it would not take my text inputs. But it would create empty questions so that is interesting to note.
sample

@jygh98
Copy link
Member

jygh98 commented Jul 28, 2017

error_deployment.html

This is a functional webpath, it does seem that Allie commented out exception paths that would return this page such as in deployment_form():

@app.route('/deploymentform', methods=['GET', 'POST'])
@login_required
def deployment_form():
  
'''
    else:
        print(form.errors)
    #except:
    return render_template('error_deployment.html')
 '''

Not too sure why she decided to do this as currently on deployment any error page would lead to an 500 Internal Server Error. Below is how the web page looks like.

dsa

@jygh98
Copy link
Member

jygh98 commented Jul 28, 2017

error_page

Again, same as before error_page appears to be commented out in the main code.

error

@jygh98
Copy link
Member

jygh98 commented Jul 28, 2017

manage_questions

Appears to be a functional webpath, however the views.py has to be modified slightly to pass the question objects to actually display the questions. I am not too sure what is the point of this page as we do have /showquestions that accomplishes a similar purpose.

manage

@jygh98
Copy link
Member

jygh98 commented Jul 28, 2017

survey_mode

Looks like a test page of the survey mode that we have now. Clicking the options does not do anything. Looks like another test page.

test

@jygh98
Copy link
Member

jygh98 commented Jul 28, 2017

devicepage

Taking a look at devicepage.html, it looks like it makes use of the activequestionurl

 <div class="container">
	<h1>Device</h1>
	<p>{{ question.activequestionurl }}</p>
	<h1>Question URL</h1>
	<p>\{{ question.activequestionurl }}</p>

<div class="form-group">
		{{ render_field(form.activequestionurl) }}

Which is part of the ActiveQuestionForm, and that uses of the ActiveQuestion object

class ActiveQuestionForm(FlaskForm):
urls=ActiveQuestion.query.with_entities(ActiveQuestion.activequestionurl)
print("Hi")
print(urls)
activequestionurl = SelectField(u"activequestionurl", choices=[(q.activequestionid, q.activequestionurl) for q in ActiveQuestion.query.order_by('activequestionurl')])

From devicepage.html, it looks like its purpose is to display any active questions that are currently deployed.

@jygh98
Copy link
Member

jygh98 commented Dec 18, 2017

@carlosparadis
Upon revisiting this issue it seems that we can separate the various files as such

Keep

  • formhelpers.html

Remove

  • admin_dashboard.html - this was a previous feature that would allow us to directly add questions from surveyadmin, however due to security reasons we decided it was better to add questions through the database instead
  • errordeployment.html and errorpage.html - both are currently commented out and not in use
  • manage_questions.html - webpath is not in used and appears to be now replaced by /showquestions
  • survey_mode.html - interesting webpath as it looks like we were trying to conduct surveys on surveyadmin and is simply a test page. Not in use
  • devicepage.html - functionality is not in use, appears to been able to display active questions that were deployed (ActiveQuestionForm has already been commented out)

@carlosparadis
Copy link
Member Author

blocked by #23, we can only add questions after we implement a safer authentication protocol.

@carlosparadis
Copy link
Member Author

@ryantanaka rotating this to you. Keeping as low priority, and more as final polishing once other higher importance issues are done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants