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

Evaluate meta tests 53 #8

Open
wants to merge 126 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
5f985e6
Improve env variable handling for db connections
oriooctopus Feb 1, 2022
9819671
Add getNextLessonSlug query
oriooctopus Feb 6, 2022
e671771
upgrade stapi
oriooctopus Feb 6, 2022
2aacbcf
Fix sorting order bug
oriooctopus Feb 6, 2022
ce4265a
adjust default pagination limit
oriooctopus Feb 11, 2022
293e03e
feature: Query Test & MetaTest internals
andypants888 Feb 19, 2022
e01ce01
Strapi setup walkthrough
bjornrl Feb 20, 2022
bdfe150
README updated with Markdown
bjornrl Feb 21, 2022
136b06a
feature: add findMany for multiple tests/metas
andypants888 Feb 22, 2022
1ffb1a7
feature: cleaned up lifecycle hooks
andypants888 Feb 22, 2022
3bf8d62
updated README
bjornrl Feb 25, 2022
d7b84ae
Added database setup
bjornrl Feb 25, 2022
c07f390
Added git workflow
bjornrl Feb 25, 2022
ea062ce
small changes after feedback
bjornrl Feb 25, 2022
5ff2f5f
Merge pull request #2 from bjornrl/update-readme
oriooctopus Feb 28, 2022
304f06d
Changed npm to yarn + small fixes
bjornrl Feb 28, 2022
a488e41
Merge pull request #5 from bjornrl/update-readme
oriooctopus Feb 28, 2022
72f687e
Merge branch 'master' of https://github.com/oriooctopus/acc-v4 into t…
andypants888 Feb 28, 2022
3352422
feature: edits to pr#3 , 37-jira-task
andypants888 Feb 28, 2022
e55605a
feature: pr #3 edits round2
andypants888 Mar 1, 2022
d312b00
Merge pull request #3 from andypants888/test-validator-37
oriooctopus Mar 1, 2022
f3963e9
Fix bug on publish of lesson
oriooctopus Mar 1, 2022
83a52bf
Switch 'challenges' to 'steps'
oriooctopus Mar 2, 2022
64032d4
Readd playground type
oriooctopus Mar 2, 2022
d088571
backups
oriooctopus Mar 3, 2022
8cc3cfa
modify challenges
oriooctopus Mar 3, 2022
eb20f83
Strapi plugin config sync (#4)
bjornrl Mar 4, 2022
97988af
Update README.md
oriooctopus Mar 8, 2022
c0d619d
buggy, working metaTests
andypants888 Mar 15, 2022
8688738
debugged max call stack error
andypants888 Mar 15, 2022
686a3c5
before passing in expectPasses param
andypants888 Mar 16, 2022
01cf450
metaTests working except for false vs true negative
andypants888 Mar 16, 2022
e8f23bb
basic working metaTests
andypants888 Mar 16, 2022
eb510ca
detects incorrect evalString result type
andypants888 Mar 17, 2022
7aff3c7
partly clean metaTest result fails
andypants888 Mar 18, 2022
08f4bae
trying to rename 'test' for clarity
andypants888 Mar 18, 2022
1689265
before change 'test' lifecycles & test-evaluator
andypants888 Mar 18, 2022
b2006df
early renaming & clean up complete
andypants888 Mar 18, 2022
38626d3
Strapi config sync v2 (#6)
bjornrl Mar 18, 2022
688e463
add editor meta
oriooctopus Mar 19, 2022
af73f73
add project type
oriooctopus Mar 19, 2022
e43a500
update config data for new projects
oriooctopus Mar 19, 2022
7dffb8c
save before moving metaTest iterations to seperate function
andypants888 Mar 22, 2022
13d2239
cleaned up results array lifecycles.js
andypants888 Mar 23, 2022
76305d7
add metaLabel, clean comments
andypants888 Mar 23, 2022
1d8cc93
Options initially hidden (#7)
bjornrl Mar 23, 2022
8a5403f
complete basic auto-description of results
andypants888 Mar 24, 2022
ebc5b14
metaTest draft1 functional
andypants888 Mar 24, 2022
efacbac
improve output readability
andypants888 Mar 24, 2022
8cbcc75
Fix accidentally removed question marks
oriooctopus Mar 25, 2022
0e0427d
add challenge meta
oriooctopus Mar 25, 2022
9fefd6d
add challengeDifficulty
oriooctopus Mar 25, 2022
3d40748
fix enforceSortingError when there are no orderedEntityIds
oriooctopus Mar 26, 2022
07ab46b
Add new labeling field
oriooctopus Apr 1, 2022
c5f9ec1
Validate multiple choice challenge options
oriooctopus Apr 3, 2022
84039e8
resolved merge conflicts
andypants888 Apr 4, 2022
8154b88
remove package.lock, add to yarn.lock
andypants888 Apr 5, 2022
7671b04
Delete package-lock.json
andypants888 Apr 5, 2022
762c11f
temporarily disable internal label setting
oriooctopus Apr 5, 2022
58c2a18
initial plugin commit
oriooctopus Apr 6, 2022
94a539d
remove extra .js files
andypants888 Apr 7, 2022
f5dab2c
resolve internal-label merge conflict, accept new
andypants888 Apr 7, 2022
b65b9f9
Delete curriculum-helpers.js
andypants888 Apr 7, 2022
ec37ff5
Delete general.js
andypants888 Apr 7, 2022
90d247a
Delete test-evaluator.js
andypants888 Apr 7, 2022
bcde267
Delete utils.js
andypants888 Apr 7, 2022
5286db0
basic metaTest feature complete, await clean-up
andypants888 Apr 7, 2022
c242c09
cleaner logic on <Finally Result>
andypants888 Apr 8, 2022
c16849a
console.standardLog is reactivated, valid for tests
andypants888 Apr 8, 2022
bcef01b
added basic check for metaTestCode errors
andypants888 Apr 8, 2022
518fa9e
Rough draft of ChallengeSuperview plugin
oriooctopus Apr 8, 2022
0c1ca00
Finishing touches
oriooctopus Apr 8, 2022
2aead3a
unhardcode backend url
oriooctopus Apr 10, 2022
f34e6fb
add namePrivateClarifications
oriooctopus Apr 10, 2022
804e22e
Merge branch 'master' of https://github.com/oriooctopus/acc-v4 into e…
andypants888 Apr 12, 2022
eadb87a
save: before rewriting error logic
andypants888 Apr 13, 2022
c273ba3
cleaned up logic of results
andypants888 Apr 13, 2022
4ff36ee
save: before refactor if else blocks
andypants888 Apr 15, 2022
a719f39
refactor if boolean blocks
andypants888 Apr 15, 2022
352e344
reduce nesting error logic
andypants888 Apr 15, 2022
24405fb
metaTest feature basics complete
andypants888 Apr 15, 2022
4a2991f
save: before remove comments/cleanup
andypants888 Apr 15, 2022
e9d9ff0
Add name to MultipleChoiceChallenge
oriooctopus Apr 19, 2022
97004e3
Merge branch 'master' of https://github.com/oriooctopus/acc-v4 into e…
andypants888 Apr 22, 2022
92b2de3
Update project schema
oriooctopus Apr 23, 2022
4c47bb3
Add internalLabel for sublessons
oriooctopus Apr 23, 2022
2bfd557
Update config sync files
oriooctopus Apr 24, 2022
97f5893
test out config sync plugin
oriooctopus Apr 24, 2022
d845c05
adjust view settings
oriooctopus Apr 27, 2022
a4d1ba8
Increase API limits
oriooctopus Apr 27, 2022
ac4c119
Fix bug on internallabel
oriooctopus Apr 30, 2022
5ae2d86
Add editorMeta to playground
oriooctopus May 3, 2022
d47a4c1
Adjust labeling
oriooctopus May 3, 2022
35c3218
Add getPracticeChallenges
oriooctopus May 12, 2022
15b455e
merge lifecycles.js resolved
andypants888 May 23, 2022
72a213d
merge conflict accept both package.json
andypants888 May 23, 2022
0c8f0c7
finished merge conflict issues
andypants888 May 23, 2022
6d839ba
deactivate failing examples
andypants888 May 25, 2022
9a7350c
fix gitignore scaling issue
andypants888 May 25, 2022
c290555
address elegancy here: https://github.com/oriooctopus/acc-v4/pull/8\#…
andypants888 Jun 20, 2022
3eaca47
tidy up newTest.error
andypants888 Jun 20, 2022
afdfc87
save before moving switch-case to own function
andypants888 Jun 20, 2022
d0cf43b
moved switch-case to determineCase function
andypants888 Jun 20, 2022
21e6854
cleaned up PR draft 1
andypants888 Jun 21, 2022
2ad628d
restore: before removing runInternalTests()
andypants888 Jun 23, 2022
1237dd0
removed runInternalTests() & reoganize output
andypants888 Jun 23, 2022
86236c9
simplify error output
andypants888 Jun 23, 2022
2d879e9
divide output into short & long, add comments
andypants888 Jun 23, 2022
35114f2
combine map & sort
andypants888 Jun 24, 2022
91c5290
move compareIds() to utils
andypants888 Jun 24, 2022
a2d6076
fix naming & comments
andypants888 Jun 24, 2022
cff20cb
pre-lunch save
andypants888 Jun 24, 2022
d999483
simplify determineReturnObject() logic
andypants888 Jun 24, 2022
76fe019
address comments about var names & reassignment
andypants888 Jun 24, 2022
6c8b517
addressed utils.ts comments
andypants888 Jun 24, 2022
428ddd7
address ts compiler errors
andypants888 Jun 24, 2022
b1dedd3
after address comments
andypants888 Jun 27, 2022
a8bfae1
double-checked comments, pending review
andypants888 Jun 27, 2022
88a10c4
strip-comments not previously installed
andypants888 Jun 28, 2022
599be10
save: before edit internalTest -> internalTestID
andypants888 Jul 5, 2022
b1b561d
save: before rename internalTestCode --> internalTest
andypants888 Jul 5, 2022
b0f0731
almost done renaming internalTestCode
andypants888 Jul 5, 2022
916515e
remove renaming function
andypants888 Jul 6, 2022
c9dc21b
save: before making dist folder
andypants888 Jul 6, 2022
fed7519
final touchs metaTests
andypants888 Jul 6, 2022
f1e1f31
final comments before merge
andypants888 Jul 7, 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
8 changes: 6 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
HOST=0.0.0.0
PORT=1337
JWT_SECRET=a3a5d540-4320-45b4-b7ef-0dcf8e07a41e
API_TOKEN_SALT=b706d554059caa52f003a5212613e3ac
IS_PRODUCTION=false
DATABASE_USER=acc-v4
DATABASE_NAME=acc-v4
DATABASE_PASSWORD=password
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ ssl
nbproject
public/uploads/*
!public/uploads/.gitkeep
.vscode/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.vscode/launch.json is a config file that gets added to the project from the vscode debugger.

I wanted to keep all vscode config files out of our final repo


############################
# Node.js
Expand All @@ -102,6 +103,13 @@ node_modules
testApp
coverage

############################
# Meta Tests
############################

src/api/code-challenge/content-types/code-challenge/*.js
!src/api/code-challenge/content-types/code-challenge/lifecycles.js
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these being ignored?

Copy link
Contributor Author

@andypants888 andypants888 Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my "scalable" way of dealing with the .js files created during typescript compilation.

lifecycles.js had an issue with typescript on strapi. Strapi V4 announced May 12, 2022 they would begin beta support for typescript in this post.

Do you want me to investigate the beta support? Currently we are not using TS for the strapi lifecycles hooks file.

We originally discussed it here:
#8 (comment)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love it if you did that.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't think the compiled files should go in the same folder as the uncompiled files. I think they should go in adist folder or something. That would automatically solve the gitignore issue as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love it if you did that.

To test the beta version of TypeScript support, run the command npx create-strapi-app@beta my-app (--ts) in a terminal.
I will need to rebuild the app. I will save this for the last part.

Can I restore the previous version using git reset --hard ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've decided to wait a month for strapi to continue working out bugs with their beta typescript support

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't think the compiled files should go in the same folder as the uncompiled files. I think they should go in adist folder or something. That would automatically solve the gitignore issue as well

I agree with the dist folder, but should the dist folder be a clone of the src folder or just a smaller folder within src? Currently very few files are being used with TS, and TS support is still in beta for strapi

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say a clone of the src folder but let me know if you have issues

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will wait until strapi integrates TS to implement the outDir & srcDir, since I'm not sure if running "strapi start" / "strapi develop" will work with a dist folder yet.


############################
# Strapi
############################
Expand All @@ -112,3 +120,4 @@ exports
*.cache
build
.strapi-updater.json

104 changes: 102 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,103 @@
# Strapi application
# Setting up Strapi

A quick description of your strapi application
### Quickstart

###### This section only works for mac and linux

Windows sections will be added later. For now check out these links to set up:

- Windows: https://www.microfocus.com/documentation/idol/IDOL_12_0/MediaServer/Guides/html/English/Content/Getting_Started/Configure/_TRN_Set_up_PostgreSQL.htm

#### Setting up database for Mac users

##### Installing HomeBrew

1. Install Homebrew by running command: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`. _(This will ask for you password and confirmation of download)_
2. Check that homebrew is up to date and healty by running: `brew update` then `brew doctor`

##### Installing postgres

3. Install Postgres by running: `brew install postgresql`
4. Start Postgres service by running: `brew services start postgresql`
5. If you get error: "Error: role 'postgres' does not exist", run command: `/usr/local/opt/postgres/bin/createuser -s postgres`

_Remember to run `npm run build` and `npm run develop` after doing these steps._

_PS: The step “Downloading Command Line Tools for Xcode” can take very long._
My best suggestion for that is checking out this discussion: https://github.com/Homebrew/discussions/discussions/131

And especially this comment:

Apple's XCode command-line installer is...quite uncommunicative. You have at least two choices: 1. Wait for as long as it takes...or the installer errors out. 2. Go to https://developer.apple.com/download/more/ (you'll need to sign up for an Apple developer account if you don't have one), then download and install the latest Command Line Tools package that your OS supports.

### Import database

After setting up strapi, you need to import the database. This is how you do that.

1. First, add the database file to the native layer in your repo. It should be named something like “backup-remote-….-.pgsql”
2. In your terminal, go into postgres: `psql template0`
3. Check roles: `\du`
- You will most likely see that you are a "superuser" in some databases, some not. This gives special admin rights to the database, which you will need
4. Create database for this project, call it "acc-v4": `CREATE DATABASE "acc-v4"`.
5. Make yourself a superuser: `alter user [username] with superuser`.
6. Add login permission: `alter role [username] with login`
7. Exit postgres: `\q`
8. Import the database: `pg_restore -U [username] -d acc-v4 -1 [name-of-file]`
9. Run `yarn build` and then `yarn develop`. You should now be set up. Go to http://localhost:1337/admin/ (Or whatever localhost it is running on) and check!

#### Notes:

- To import the database correctly, it needs to be totally empty when you do it. When you are not familiar with PostgreSQL it is easy to type wrong, make small mistakes etc., which can lead to the database not being ready to import when you try. This can be easily solved by deleting the database `DROP DATABASE [name-of-database]` and creating a new one `CREATE DATABASE [name-of-database]`. This will give you a clean slate to try importing again.
- Always remember `;` at the end of your lines, commands in PostgreSQL wont run without them. If you forget, just type `;` in the next line and press `ENTER`.
- Backslash is achieved with `SHIFT+OPTION+7`on a Mac.

### More info

Most of the steps here are taken directly from this website: https://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/. There is more to learn there.

HomeBrew is a package manager that takes care of everything NPM or Yarn doesn´t. Read more about it on https://brew.sh/

It will ask for your password and to confirm the download.

Beware that the step “Downloading Command Line Tools for Xcode” can take very long. My best suggestion for that is checking out this discussion:

https://github.com/Homebrew/discussions/discussions/131

And especially this comment:

Apple's XCode command-line installer is...quite uncommunicative. You have at least two choices: 1. Wait for as long as it takes...or the installer errors out. 2. Go to https://developer.apple.com/download/more/ (you'll need to sign up for an Apple developer account if you don't have one), then download and install the latest Command Line Tools package that your OS supports.

Don´t worry, it takes some time, but will complete in the end.

After all this, you might get the error: “error: role "postgres" does not exist”

To solve that, simply run this in the command line:

/usr/local/opt/postgres/bin/createuser -s postgres

Then, run "yarn build” and "yarn develop” again and you should be good!

### Useful git commands

When you work on this project, you will du that on your own fork. You will make branches for each added feature, push changes and then merge the branches when the feature are reviewed by others. Here is a breakdown of your workflow:

1. Set upstream repo. Olivers repo is our "source of truth": `git remote add upstream [email protected]:oriooctopus/acc-v4.git`
2. Pull master - make sure you´re up to date: `git pull`
3. Make a branch for the change you´re about to make: `git checkout -b [name-of-branch]`
4. Make the changes/Write the code
5. Add changes with `git add [name-of-file`
6. Commit changes with `git commit -m "[notes about changes]"`
7. Push changes: `git push origin HEAD`
8. Go to github and make a pull request for your changes.

#### Notes

In general there is some thing you need to learn about working with git. Don´t be afraid to ask. You should also go through this tutorial on git branching, it is very helpful: https://learngitbranching.js.org/

- Git Lens is a very helpful VSCode extension: Go install it. (Add picture etc.)
- When you have made your branch, you can check your branches by entering this command: `git branch`. It will also tell you which branch you are on.
- When you have made a pull request on a branch and make more changes. Don´t make another pull request, it will update when you push the new changes.
- When you type git rebase -I HEAD~[num] you, for some fucking unknown reason, enter this vim fuckery. Without a fucking course you will also be stuck there and god forbid the changes you want to make will actually be made. So, here is a little guide for how to deal with this godforsaken dickcheese of a feature.
- :q - no changes were made
- :q! - trash all changes
- :wq - save the changes and quit
Loading