Skip to content

Commit

Permalink
Removed survey
Browse files Browse the repository at this point in the history
  • Loading branch information
johc committed Apr 25, 2024
1 parent d77ebad commit 61ed69b
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 109 deletions.
2 changes: 1 addition & 1 deletion flask_monitoringdashboard/core/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def init_from(self, file=None, envvar=None, log_verbose=False):

class TelemetryConfig(object):
"""Configuration for the telemetry feature"""
# constants for defining survey and telemetry answers
# constants for defining telemetry answers
NOT_ANSWERED = 1
REJECTED = 2
ACCEPTED = 3
Expand Down
5 changes: 1 addition & 4 deletions flask_monitoringdashboard/core/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ def initialize_telemetry_session(session):
telemetry_user.last_initialized = datetime.datetime.utcnow()
session.commit()

# reset telemetry and survey prompt if declined in previous session
# reset telemetry if declined in previous session
if telemetry_user.monitoring_consent == TelemetryConfig.REJECTED:
telemetry_user.monitoring_consent = TelemetryConfig.NOT_ANSWERED
session.commit()
if telemetry_user.survey_filled == TelemetryConfig.REJECTED:
telemetry_user.survey_filled = TelemetryConfig.NOT_ANSWERED
session.commit()

# check if telemetry's been agreed on
telemetry_config.telemetry_consent = True if telemetry_user.monitoring_consent == TelemetryConfig.ACCEPTED else False
Expand Down
3 changes: 0 additions & 3 deletions flask_monitoringdashboard/database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ class TelemetryUser(Base):
last_initialized = Column(DateTime, default=datetime.datetime.utcnow)
"""Check when was the last time user accessed FMD"""

survey_filled = Column(Integer, default=1)
"""If user filled the survey 1 - not responded 2 - declined 3 - filled"""

monitoring_consent = Column(Integer, default=1)
"""If user agrees to share data 1 - not responded 2 - declined 3 - accepted"""

Expand Down
5 changes: 0 additions & 5 deletions flask_monitoringdashboard/frontend/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import { DatabaseManagementController } from './controllers/databaseManagementCo
import { EndpointVersionIPController } from './controllers/endpointVersionIP';
import { EndpointVersionController } from "./controllers/endpointVersion";
import { MonitorLevelController } from "./controllers/monitorLevel";
import { SurveyController } from "./controllers/surveyController";
import { TelemetryController } from "./controllers/telemetryController";


Expand Down Expand Up @@ -85,10 +84,6 @@ app.controller('EndpointController', ['$scope', 'endpointService', EndpointContr
app.controller('PaginationController', ['$scope', 'paginationService', PaginationController]);
app.controller('ModalController', ['$scope', '$window', '$browser', 'modalService', ModalController]);

app.component('surveyComponent', {
templateUrl: 'static/pages/survey.html',
controller: SurveyController
});
app.component('telemetryComponent', {
templateUrl: 'static/pages/telemetry.html',
controller: TelemetryController
Expand Down

This file was deleted.

13 changes: 1 addition & 12 deletions flask_monitoringdashboard/static/js/app.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions flask_monitoringdashboard/static/pages/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
</div>

<div>
{{ telemetryShow }}
<survey-component></survey-component>
<telemetry-component></telemetry-component>
</div>

Expand Down
5 changes: 0 additions & 5 deletions flask_monitoringdashboard/static/pages/survey.html

This file was deleted.

25 changes: 0 additions & 25 deletions flask_monitoringdashboard/views/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,13 @@ def accept_telemetry_consent():
return '', 204


@blueprint.route('/telemetry/survey_has_been_filled', methods=['GET'])
def survey_has_been_filled():
with session_scope() as session:
try:
telemetry_user = get_telemetry_user(session)
telemetry_user.survey_filled = TelemetryConfig.ACCEPTED
session.commit()

except SQLAlchemyError as e:
print('error committing survey consent to database', e)
session.rollback()

# Return no content
return '', 204


@blueprint.route('/telemetry/get_is_telemetry_answered', methods=['GET'])
def get_is_telemetry_answered():
with session_scope() as session:
telemetry_user = get_telemetry_user(session)
res = True if telemetry_user.monitoring_consent in (TelemetryConfig.REJECTED, TelemetryConfig.ACCEPTED) else False
return {'is_telemetry_answered': res}


@blueprint.route('/telemetry/get_is_survey_filled', methods=['GET'])
def get_is_survey_filled():
with session_scope() as session:
telemetry_user = get_telemetry_user(session)
res = True if telemetry_user.survey_filled in (TelemetryConfig.REJECTED, TelemetryConfig.ACCEPTED) else False
return {'is_survey_filled': res}


@blueprint.route('/telemetry/submit_follow_up', methods=['POST'])
def submit_follow_up():
data = request.json
Expand Down

0 comments on commit 61ed69b

Please sign in to comment.