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

Faq backend #19

Open
wants to merge 672 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
672 commits
Select commit Hold shift + click to select a range
08d844e
Fixed issues with merge
Ryzon3 Jul 31, 2022
35082be
Adding some styling to the import page
dimitri-lopez Aug 1, 2022
3a08a82
Revert pathway scraper code and remove duplicates
Benjamin-Avrahami Aug 1, 2022
843ba4d
fixed issue 142 for multiyear
Benjamin-Avrahami Aug 1, 2022
ca0fa18
Adding chips to the search page
dimitri-lopez Aug 2, 2022
78bd56b
Adding chips to the search page
dimitri-lopez Aug 2, 2022
3f1e602
Merge branch 'main' into advanced-search
dimitri-lopez Aug 2, 2022
8998999
Revert "Adding chips to the search page"
dimitri-lopez Aug 2, 2022
15c0678
Adding advanced search features to the choose page
dimitri-lopez Aug 2, 2022
5acae6f
Changing chips to reduce latency
dimitri-lopez Aug 2, 2022
bf9fdbd
Adding an example of using the advanced search
dimitri-lopez Aug 2, 2022
5efa75e
Moved the alert out of the way
michaelni678 Aug 2, 2022
944461a
Switch is finally done
dicosn Aug 2, 2022
e3479c9
Merge pull request #147 from anderm18/dicosn-issues
anderm18 Aug 2, 2022
e82a844
Merge pull request #149 from anderm18/FixPrereqAlert
anderm18 Aug 2, 2022
65cb4cd
Merge pull request #144 from anderm18/jsonDuplicates
anderm18 Aug 2, 2022
0d89c74
Converted store to seperate file and added years.json
Ryzon3 Aug 2, 2022
f6f9989
Added years.json functionality
Ryzon3 Aug 2, 2022
19c7e00
Fixed #150 in a semi-satisfactory way and removed warnings
Benjamin-Avrahami Aug 4, 2022
7addb8b
Changed zindex of header, now in front of check boxes
michaelni678 Aug 5, 2022
5d9682b
Ran linter and fixed data,js
Ryzon3 Aug 5, 2022
dcebb40
Merge branch 'main' into multi-year-json
Ryzon3 Aug 5, 2022
6ec74cd
fix depts.json bug
Ryzon3 Aug 5, 2022
98b0c59
Fixed required courses, remaining, etc
michaelni678 Aug 5, 2022
0dd271b
FIxed multi year bugs
Ryzon3 Aug 9, 2022
2521197
Rewriting py scraper into js for transcript parsing
dimitri-lopez Aug 9, 2022
12ec9e3
Adding a period to the example
dimitri-lopez Aug 9, 2022
b25587a
Test commit
Aug 9, 2022
df8b7b9
Merge branch 'main' into advanced-search
Ryzon3 Aug 9, 2022
83f718a
Merge pull request #143 from anderm18/advanced-search
Ryzon3 Aug 9, 2022
64121a7
Merge branch 'main' into multi-year-json
Ryzon3 Aug 9, 2022
1d163ef
fix courses with undefined data not showing up on my pathways page
liuj-42 Aug 9, 2022
d1e352c
Fixed merge issues on fromClassesPage
Ryzon3 Aug 9, 2022
e8cbeac
Fixed AdvancedSearchPage for Multi year JSON
Ryzon3 Aug 9, 2022
737b32f
Fixed warnings
Ryzon3 Aug 11, 2022
37d40c4
Fixed more warnings
Ryzon3 Aug 11, 2022
97992f6
Merge branch 'main' into multi-year-json
Ryzon3 Aug 11, 2022
7c64937
Merge pull request #156 from anderm18/multi-year-json
Ryzon3 Aug 11, 2022
654b075
Selecting the courses based on the parsing
dimitri-lopez Aug 11, 2022
42ebab4
Adding text upon import
dimitri-lopez Aug 11, 2022
93fcf7a
Fixed Admin Pages to work with multi year
Ryzon3 Aug 12, 2022
86a606a
Fixed warnings
Ryzon3 Aug 12, 2022
de6dcd0
fix deleting pathways on mypathways page not updaing the page
liuj-42 Aug 12, 2022
9195712
Updated scraper to fill empty courses and work with new catalog
Ryzon3 Aug 13, 2022
9e3e8c7
Finished transcript scraper
dimitri-lopez Aug 13, 2022
008f1a8
Making a fix with cross listed courses
dimitri-lopez Aug 13, 2022
9ef425a
Added category assembler and ran
Ryzon3 Aug 13, 2022
f31872c
Fixed Pathway Category component to work with new Data
Ryzon3 Aug 13, 2022
4be3b4c
Adding 404 page if pathway not found
Ryzon3 Aug 13, 2022
e3b7d26
Reducing lag on select pathway from classes page
dimitri-lopez Aug 13, 2022
ac25a32
Updating regex for advanced search
dimitri-lopez Aug 13, 2022
7a026fa
Merge branch 'main' into ProfessorAvailabilityBubble
Ryzon3 Aug 13, 2022
679edda
Added UIA to scraper and fixed some bugs
Ryzon3 Aug 13, 2022
c7c44ca
Merge pull request #138 from anderm18/ProfessorAvailabilityBubble
Ryzon3 Aug 14, 2022
5615285
Merge pull request #153 from anderm18/Checkboxes_over_header
Ryzon3 Aug 14, 2022
0b59b83
FIxed names
Ryzon3 Aug 14, 2022
82e4054
Merge branch 'main' into pathway-category-fix
Ryzon3 Aug 14, 2022
e56cfe3
Merge pull request #157 from anderm18/pathway-category-fix
Ryzon3 Aug 14, 2022
769c99f
Ran scraper and fixed minor bug
Ryzon3 Aug 14, 2022
e79b68a
Fixed warning
Ryzon3 Aug 14, 2022
9003520
Added RPI HASS website to about page
Ryzon3 Aug 14, 2022
0a9025a
Updated readme and deleted old TODO document
Ryzon3 Aug 14, 2022
d348101
Fixed readme
Ryzon3 Aug 14, 2022
e71d8af
Removed the hardcoding of the initial year selection
Benjamin-Avrahami Aug 15, 2022
09d0514
Darkened the my pathways button and moved the selection and light mod…
Benjamin-Avrahami Aug 15, 2022
758d83a
Merge branch 'main' into footer-fix
Ryzon3 Aug 15, 2022
6087ad0
importing advanced search
Ryzon3 Aug 15, 2022
c2eca92
Merge pull request #152 from anderm18/footer-fix
Ryzon3 Aug 15, 2022
9f704ec
Merge pull request #159 from anderm18/auto_year
Ryzon3 Aug 15, 2022
4ce5b00
Added crosslisted and prereq to portal Closes #107
Ryzon3 Aug 15, 2022
87dc913
Merge pull request #160 from anderm18/AdminPortalUpdate
Ryzon3 Aug 15, 2022
f62e68f
Merge branch 'main' into import-transcript
dimitri-lopez Aug 15, 2022
a6b7f54
Fixed scraper bug that I made
Ryzon3 Aug 15, 2022
00f76b9
Uncommented scraper post bug
Ryzon3 Aug 15, 2022
54254e2
Fixed some unicode errors
Ryzon3 Aug 15, 2022
5ef2bf2
Fixed TODO within code
Ryzon3 Aug 15, 2022
5e5c918
Merge pull request #158 from anderm18/import-transcript
Ryzon3 Aug 15, 2022
71d3715
Updating Backend script to match the one running on EC2
anderm18 Aug 16, 2022
3788207
Merge branch 'main' of https://github.com/anderm18/HASSPathways
anderm18 Aug 16, 2022
983a027
requirements for install
anderm18 Aug 16, 2022
cc5fcf5
Backend update
anderm18 Aug 16, 2022
4a6d493
Update README.md
anderm18 Aug 16, 2022
8e59eba
Fix light mode on Pathway images
Ryzon3 Aug 16, 2022
461acf5
Removed delete button from MyPathway conditionally closes #161
Ryzon3 Aug 16, 2022
4f027df
Updating readme for frontend
Ryzon3 Aug 16, 2022
4118062
Revert "Updating readme for frontend"
Ryzon3 Aug 16, 2022
20350c5
Fixing readme for frontend
Ryzon3 Aug 16, 2022
2935e3a
Fixing frontend readme
Ryzon3 Aug 16, 2022
7888279
Fixing file tree in frontend readme
Ryzon3 Aug 16, 2022
ff15289
Merge pull request #162 from anderm18/MyPathway-delete-fix
Ryzon3 Aug 16, 2022
f1da158
Removing old project structure document
Ryzon3 Aug 16, 2022
7ee3062
Merge branch 'main' of https://github.com/anderm18/HASSPathways into …
Ryzon3 Aug 16, 2022
52ff8e6
Made scroll reset back to top on route change
Ryzon3 Aug 16, 2022
6d9dcc6
Added text for waiting data load
Ryzon3 Aug 17, 2022
e9687e0
Fixing sorting on FromClassesPathways
dimitri-lopez Aug 17, 2022
e82f387
Fixing the buttons on the home page. Better zoomfn
dimitri-lopez Aug 17, 2022
bfae102
Changing the redirect for choose classes
dimitri-lopez Aug 17, 2022
f9282f3
Merge branch 'Bram-Hub:main' into better-homepage-buttons
dimitri-lopez Aug 17, 2022
a32eae9
Make rows clickable on advsearch
Ryzon3 Aug 17, 2022
27e0604
adding execa
RafaelCenzano Aug 18, 2022
16ab18f
Merge branch 'main' of github.com:anderm18/HASSPathways
RafaelCenzano Aug 18, 2022
bca12ce
create github actions workflow instructions
RafaelCenzano Aug 18, 2022
fae5430
add build and deploy script to be executed by github actions
RafaelCenzano Aug 18, 2022
88e046b
merge with main and add execa
RafaelCenzano Aug 18, 2022
ce26513
add more config for github actions deployment script
RafaelCenzano Aug 18, 2022
037d8dd
Merge pull request #163 from anderm18/better-homepage-buttons
Ryzon3 Aug 18, 2022
92cd6c3
Added better future proof sort
Ryzon3 Aug 18, 2022
01757fb
Merge pull request #154 from anderm18/required_remaining_tabs_switch
Ryzon3 Aug 18, 2022
e90b3ec
Merge pull request #164 from anderm18/frontend-deploy-gh-pages
anderm18 Aug 19, 2022
2653c13
Revert "New scripts for gh actions deployment to gh pages"
anderm18 Aug 19, 2022
35eaa94
Merge pull request #165 from anderm18/revert-164-frontend-deploy-gh-p…
anderm18 Aug 19, 2022
b518f06
Full SIS scraper rewrite + added profs
Ryzon3 Aug 19, 2022
01649f3
Added prof text to frontend
Ryzon3 Aug 19, 2022
fbd84f9
Fix bug on professors not having comments between them
Ryzon3 Aug 20, 2022
73f90d8
Fixed scraper ascii issues and added two year window to CI/Profs
Ryzon3 Aug 20, 2022
113bd3b
Added skeletone framework for Course page based on Pathway page archi…
WitherKNyx Sep 24, 2022
13df04f
Made Course category json file and filled out the home Course page.
WitherKNyx Sep 26, 2022
2ca6b09
Added Individual Course Pages
WitherKNyx Sep 26, 2022
a56b307
Added Prerquisites and Term Availability to Course Pages
WitherKNyx Sep 26, 2022
942b39d
Added course links to pages with courses
WitherKNyx Oct 4, 2022
53e8a4e
Update CourseTable.vue
PlayX-2333 Oct 4, 2022
f1b54c7
Merge branch 'course-pages' into ryan-feature-branch
WitherKNyx Oct 4, 2022
74d15cd
Update CourseTable.vue
jonha1 Oct 4, 2022
8fa6f90
Merge branch 'sorting-option' of https://github.com/anderm18/HASSPath…
jonha1 Oct 4, 2022
14df1a3
Merge pull request #184 from anderm18/ryan-feature-branch
WitherKNyx Oct 4, 2022
3180137
Update CourseTable.vue
jonha1 Oct 4, 2022
7988727
Added underline to link in Advanced Class Search
WitherKNyx Oct 4, 2022
0e94b94
Changed Courses page Icon
WitherKNyx Oct 7, 2022
f9966a2
Update CourseTable.vue
jonha1 Oct 7, 2022
23c3c5f
Changed Courses page to use expansion panels instead of cards
WitherKNyx Oct 7, 2022
fa090c4
Update CourseTable.vue
PlayX-2333 Oct 7, 2022
31d85aa
first 3 class information
kesfc Oct 7, 2022
156b444
Update CourseTable.vue
jonha1 Oct 7, 2022
a641edb
Refactored Course Categories into Columns
WitherKNyx Oct 7, 2022
5dca781
some update of information structure and all class information till "…
kesfc Oct 7, 2022
f03b87b
Merge branch 'course-pages' of https://github.com/anderm18/HASSPathwa…
kesfc Oct 7, 2022
c42924f
Sorting options to explore pathway page
PlayX-2333 Oct 7, 2022
3d81a22
Update CourseTable.vue
jonha1 Oct 11, 2022
0faa92f
Merge branch 'sorting-option' of https://github.com/anderm18/HASSPath…
jonha1 Oct 11, 2022
2dd7f6d
fix a bug
PlayX-2333 Oct 11, 2022
ea90833
Merge branch 'sorting-option' of https://github.com/anderm18/HASSPath…
PlayX-2333 Oct 11, 2022
95a5c5d
Update data
kesfc Oct 11, 2022
a0b22c5
Data update
kesfc Oct 11, 2022
bf110e5
Update CourseTable.vue
PlayX-2333 Oct 11, 2022
8df5e35
Update CourseTable.vue
jonha1 Oct 11, 2022
62c8ffe
Merge branch 'sorting-option' of https://github.com/anderm18/HASSPath…
jonha1 Oct 11, 2022
1f18d07
data update
kesfc Oct 11, 2022
7446130
Update CourseTable.vue
jonha1 Oct 11, 2022
f9a9b7b
Update CourseTable.vue
jonha1 Oct 11, 2022
50536d5
Update courses.json
gnehcuyz Oct 15, 2022
f231528
Add current_providing to each course
gnehcuyz Oct 15, 2022
aae4783
Update information for some course
gnehcuyz Oct 15, 2022
1a65c75
add more data and some change
kesfc Oct 15, 2022
64e0da5
Add course information till "Critical Thinking"
gnehcuyz Oct 16, 2022
d4a1d50
Merge branch 'course-pages' of https://github.com/anderm18/HASSPathwa…
gnehcuyz Oct 16, 2022
011e749
Update courses.json
gnehcuyz Oct 16, 2022
98688cf
data update
kesfc Oct 17, 2022
e175ed7
fixing erro
kesfc Oct 18, 2022
f75ec8e
Update CoursePage.vue
gnehcuyz Oct 18, 2022
d9f8de9
data update
kesfc Oct 18, 2022
6745179
Merge branch 'course-pages' of https://github.com/anderm18/HASSPathwa…
kesfc Oct 18, 2022
64b4732
Updated SIS Scraper to get information on Course Sections.
WitherKNyx Oct 20, 2022
d21191f
Merge branch 'scraper-testing' into course-pages
WitherKNyx Oct 20, 2022
922ad33
Fixed courses_scraper to correctly find prerequiste courses
WitherKNyx Oct 20, 2022
d5f9e0a
Removed unnecessary line of code causing minor error
WitherKNyx Oct 20, 2022
06e73e3
Merge branch 'course-pages' into scraper-testing
WitherKNyx Oct 20, 2022
88f0f1f
Merge pull request #185 from anderm18/scraper-testing
WitherKNyx Oct 20, 2022
5ad8175
Added SIS and Course Scraper updates to be merged to main
WitherKNyx Oct 21, 2022
3e5d6d9
Update FromClassesPage.vue
PlayX-2333 Oct 21, 2022
476ecc8
Add the Profressor information to the course page template
gnehcuyz Oct 21, 2022
8c9fd37
Merge branch 'course-pages' of https://github.com/anderm18/HASSPathwa…
gnehcuyz Oct 21, 2022
9371a39
Update FromClassesPage.vue
PlayX-2333 Oct 21, 2022
95a234e
Update FromClassesPage.vue
PlayX-2333 Oct 21, 2022
aea2e92
Merge pull request #188 from anderm18/scraper-updates
anderm18 Oct 21, 2022
6e77700
Merge branch 'main' into course-pages
WitherKNyx Oct 21, 2022
fce963f
Merge pull request #189 from anderm18/sorting-option
anderm18 Oct 21, 2022
d92e001
add professor's name and check if the class is providing or not
kesfc Oct 21, 2022
fed6421
Change SectionNum-CRN to a button
gnehcuyz Oct 21, 2022
d6a311c
Merge branch 'course-pages' of https://github.com/anderm18/HASSPathwa…
gnehcuyz Oct 21, 2022
1bfb75d
Add a function to correspond professors and their own sections
gnehcuyz Oct 23, 2022
1e1e0ae
Update the function profSec and try to display the return value of pr…
gnehcuyz Oct 23, 2022
a7c809a
Fixed profSec not reading in professors properly
WitherKNyx Oct 23, 2022
c3b8d97
Zone the sections for different professors
gnehcuyz Oct 24, 2022
cf519b7
Add two button: ALL and NONE
gnehcuyz Oct 25, 2022
ac9f6e5
Attempt 1 at working on expansion panels for sections
WitherKNyx Oct 26, 2022
d547e10
Made buttons open all section expansion cards
WitherKNyx Oct 27, 2022
e50cdec
Buttons now only open/close sections for a specific professor
WitherKNyx Oct 27, 2022
f071097
Merge branch 'course-pages' into section-expansion-cards
WitherKNyx Oct 27, 2022
ca79636
Merge pull request #191 from anderm18/section-expansion-cards
WitherKNyx Oct 27, 2022
48372af
Update the appearance of the button and add a condition render
gnehcuyz Oct 27, 2022
7194032
Merge branch 'main' into ryan-feature-branch
anderm18 Oct 28, 2022
1b6e2ae
Merge pull request #166 from anderm18/ryan-feature-branch
anderm18 Oct 28, 2022
4569581
delete "instructor(s) name"
gnehcuyz Oct 28, 2022
3da491c
API Info
jonha1 Oct 28, 2022
5f3dd43
HTML API Page
jonha1 Oct 31, 2022
0c68df7
Merge pull request #193 from anderm18/Info_Page_
anderm18 Oct 31, 2022
e823e51
Formatting API Page
jonha1 Oct 31, 2022
3567957
Fixed minor warning
WitherKNyx Oct 31, 2022
b0fa468
Merge pull request #195 from anderm18/Info_Page_
anderm18 Nov 1, 2022
7f21cf7
Deleted extra homebutton on homepage
jonha1 Nov 1, 2022
34d63c8
Revert "Deleted extra homebutton on homepage"
jonha1 Nov 1, 2022
a1d0cf4
Delete xtra homepage button
jonha1 Nov 1, 2022
432ff9f
Merge pull request #197 from anderm18/temp_main
anderm18 Nov 1, 2022
07c0627
load faqs
PlayX-2333 Nov 1, 2022
4c253f8
Improve the modifiers display
gnehcuyz Nov 1, 2022
a3b34e5
Delete the rate my professor link for now
gnehcuyz Nov 1, 2022
8f111aa
Added RateMyProfessor scraper
WitherKNyx Nov 1, 2022
7a75552
Merge branch 'main' into course-pages
WitherKNyx Nov 2, 2022
8eae881
Update License
WitherKNyx Nov 3, 2022
8e19f16
Added professors.json
WitherKNyx Nov 3, 2022
ec05c8e
fixed some warning
kesfc Nov 3, 2022
119c79e
fixed a bug
kesfc Nov 3, 2022
ff6b60f
SIS Scraper now gets CRN
WitherKNyx Nov 4, 2022
a571189
Fixing change that made it on production from a branch (my mistake)
anderm18 Nov 4, 2022
e8ac6dc
Merge branch 'main' into course-pages
WitherKNyx Nov 5, 2022
690bda5
Update AboutPage.vue
PlayX-2333 Nov 5, 2022
7088ac9
Get asked questions from backend and display in frontend
PlayX-2333 Nov 11, 2022
60524ca
Some documentations
PlayX-2333 Nov 11, 2022
a29b86e
Added place for people to write comment
kesfc Nov 12, 2022
d4ddaf1
small change
kesfc Nov 12, 2022
8b22c64
add rating
kesfc Nov 12, 2022
cd3bdcc
Fixed formatting and invalid component error
WitherKNyx Nov 13, 2022
bde32dd
Merge branch 'rate-my-prof-scraper' into course-pages
WitherKNyx Nov 13, 2022
72d01c4
Added CRN and RateMyProf link to course info
WitherKNyx Nov 13, 2022
07e873b
Fix middle names not being parsed
WitherKNyx Nov 15, 2022
66aa9ba
Fixed formatting issues which were causing warnings
WitherKNyx Nov 15, 2022
ae5dfc2
slight change of url
PlayX-2333 Nov 15, 2022
1e552b3
Merge branch 'main' into faq-backend
PlayX-2333 Nov 17, 2022
255e1ca
Slight Change
PlayX-2333 Nov 18, 2022
091c33e
Fix for professors with middile initials
WitherKNyx Nov 18, 2022
81ea23b
Update CoursePage.vue
kesfc Nov 19, 2022
7b0df24
Revert "Update CoursePage.vue"
kesfc Nov 19, 2022
00df6a8
Update CoursePage.vue
kesfc Nov 19, 2022
364f32e
Revert "Update CoursePage.vue"
kesfc Nov 20, 2022
d0b37d7
Revert "Revert "Update CoursePage.vue""
kesfc Nov 20, 2022
18c846d
some updates of getting comments
kesfc Nov 20, 2022
c68d0a3
Update FAQs to sqlite
PlayX-2333 Nov 27, 2022
2ad2154
close session after use
PlayX-2333 Nov 27, 2022
6ffaa53
Merge pull request #199 from anderm18/course-pages
anderm18 Nov 29, 2022
0a128dc
Now can create the table correctly
PlayX-2333 Dec 2, 2022
80eae19
Fixed a bug
PlayX-2333 Dec 3, 2022
64d449f
Can load questions correctly from db
PlayX-2333 Dec 3, 2022
f9ca8dd
Can now add new question from backend.
PlayX-2333 Dec 3, 2022
11b0ba7
documentation change
PlayX-2333 Dec 3, 2022
cf3f91e
Optimized structure, added a delete question page
PlayX-2333 Dec 6, 2022
00f9f79
Optimization
PlayX-2333 Dec 6, 2022
74e3fb2
Now can delete the questions from db correctly
PlayX-2333 Dec 6, 2022
0bcb416
Merge branch 'main' into faq-backend
PlayX-2333 Dec 6, 2022
7aeaa20
Integrated the delete and add together.
PlayX-2333 Dec 8, 2022
2224ed1
Optimization
PlayX-2333 Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Now can create the table correctly
But when the table already exists, there's still bug. fixing...
PlayX-2333 committed Dec 2, 2022
commit 0a128dcf89bb1a4ab383e2000f4dad6a698b1f60
Binary file added backend/FAQs.db
Binary file not shown.
10 changes: 6 additions & 4 deletions backend/FAQs/FAQ_Class.py
Original file line number Diff line number Diff line change
@@ -5,12 +5,14 @@


class Faqs(Base):
__tablename__ = 'FAQs'
id = Column(Integer, primary_key=True, autoincrement=True)
# 指定name映射到name字段; name字段为字符串类形,
Question = Column(String())
__tablename__ = 'questions'
Question = Column(String(), primary_key=True, unique=True)
Answer = Column(String())

def __int__(self, Question, Answer):
self.Question = Question
self.Answer = Answer

def __repr__(self):
return "<FAQs(Question = '%s', Answer = '%s')>" % (
self.Question, self.Answer)
2 changes: 0 additions & 2 deletions backend/FAQs/faqs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"questions": {
"DO I need to take an IHSS course for my pathway?": "Taking an IHSS course is not a requirement for pathways, but for the overall HASS requirement. Although some pathways might require a specific IHSS course.",
"Do I need to take a 4000 level courese for my pathway?": "Check the individual pathway requirements. Some pathways might require one course to be 4000 level and some might not.",
"DO I need to take communication intensive course for my pathway?": "This is not a requirement for the pathways.",
"Am I allowed to come up with my own pathway?": "Students are not allowed to create their own pathway.",
"Can my pathway count towards a minor?": "Yes, lots of pathways even have an associated minor which sometimes might only require one more course to achieve."
}
}
46 changes: 39 additions & 7 deletions backend/admin.py
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
from cas import CASClient
import flask
from sqlalchemy import *
from sqlalchemy import MetaData
from FAQs.FAQ_Class import Faqs
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import sqlite3

flask.__version__
app = Flask(__name__)
@@ -32,6 +34,12 @@ def load_faqs():
path = 'FAQs/'
file = path + 'faqs.json'
with open(file) as json_file:
db_engine = create_engine("sqlite:///faqs.db?check_same_thread=False")
Base = declarative_base()
Base.metadata.create_all(db_engine, checkfirst=True)
Session = sessionmaker(bind=db_engine)
FAQs_session = Session()
print(FAQs_session);
faqs = json.load(json_file)
return faqs

@@ -86,7 +94,6 @@ def editAdmin():
# def test():
# return render_template("admin.html")


def updateFAQs():
"""
Update all asked questions into the database.
@@ -95,15 +102,40 @@ def updateFAQs():
file = path + 'faqs.json'
with open(file) as json_file:
faqs = json.load(json_file)
db_engine = create_engine("sqlite:///faqs.db?check_same_thread=False")
Base = declarative_base()
Base.metadata.create_all(db_engine, checkfirst=True)

# get to the table
db_engine = create_engine("sqlite:///FAQs.db", echo=True)

# create table
meta = MetaData()
Questions = Table(
'questions', meta,
Column('Question', String, primary_key=True),
Column('Answer', String)
)
meta.create_all(db_engine)

# upload using sessionmanager
Session = sessionmaker(bind=db_engine)
FAQs_session = Session()
FAQs_session.add_all([Faqs(Question=q, Answer=a) for q, a in faqs])
data = []
for q, a in faqs.items():
data.append(Faqs(Question=q, Answer=a))
FAQs_session.add_all(data)
FAQs_session.commit()
FAQs_session.close_all()
FAQs_session.close()


def table_exists(engine, table_name):
with engine.connect() as con:
sql = "show tables;"
tables = con.execute(sql).fetchall()
for table_col in tables:
if table_name == table_col[0]:
return True
return False


if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000, debug=True) # http://127.0.0.1:5000/
updateFAQs()
# app.run(host='0.0.0.0', port=5000, debug=True) # http://127.0.0.1:5000/