Skip to content

Commit

Permalink
Merge pull request #1456 from AbdulWahab3181/fix/metrics-bounties-query
Browse files Browse the repository at this point in the history
Fixed GetBountiesByDateRange query to handle multiple status
  • Loading branch information
elraphty authored Jan 26, 2024
2 parents cd2bd88 + 1bf71f6 commit 56a42ee
Show file tree
Hide file tree
Showing 593 changed files with 65,021 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/prjob_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build
on:
pull_request:
branches:
- master
jobs:
build:
name: build
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn --cwd ./frontend/app install
- name: Build
run: CI=false yarn --cwd ./frontend/app run build

17 changes: 17 additions & 0 deletions .github/workflows/prjob_eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Eslint
on:
pull_request:
branches:
- master
jobs:
eslint:
name: eslint
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn --cwd ./frontend/app install
- name: Eslint
run: yarn --cwd ./frontend/app run lint

18 changes: 18 additions & 0 deletions .github/workflows/prjob_prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Prettier
on:
pull_request:
branches:
- master
jobs:

prettier:
name: prettier
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: yarn --cwd ./frontend/app install
- name: Prettier
run: CI=false yarn --cwd ./frontend/app run prettier:check

15 changes: 13 additions & 2 deletions db/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,23 @@ func (db database) GetBountiesByDateRange(r PaymentDateRange, re *http.Request)

if open != "" && open == "true" {
openQuery = "AND assignee = '' AND paid != true"
assignedQuery = ""
}
if assingned != "" && assingned == "true" {
assignedQuery = "AND assignee != '' AND paid = false"
if open != "" && open == "true" {
assignedQuery = "OR assignee != '' AND paid != true"
} else {
assignedQuery = "AND assignee != '' AND paid != true"
}
}
if paid != "" && paid == "true" {
paidQuery = "AND paid = true"
if open != "" && open == "true" || assingned != "" && assingned == "true" {
paidQuery = "OR paid = true"
} else if open != "" && open == "true" && assingned == "" && assingned != "true" {
assignedQuery = ""
} else {
paidQuery = "AND paid = true"
}
}

if sortBy != "" && direction != "" {
Expand Down
76 changes: 76 additions & 0 deletions frontend/app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package frontend

import (
"encoding/json"
"fmt"
"net/http"
"strings"

"github.com/gobuffalo/packr/v2"
)

var appBox = packr.New("app", "./app/build")

func PingRoute(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
json.NewEncoder(w).Encode("pong")
}

// IndexRoute index.html
func IndexRoute(w http.ResponseWriter, r *http.Request) {
indexHTML, err := appBox.Find("index.html")
if err != nil {
w.WriteHeader(http.StatusNotFound)
return
}
w.WriteHeader(http.StatusOK)
w.Write([]byte(indexHTML))
}

// ManifestRoute manifest.json
func ManifestRoute(w http.ResponseWriter, r *http.Request) {
manifest, err := appBox.Find("manifest.json")
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusNotFound)
return
}
w.WriteHeader(http.StatusOK)
w.Write([]byte(manifest))
}

// FaviconRoute favicon.ico
func FaviconRoute(w http.ResponseWriter, r *http.Request) {
favicon, err := appBox.Find("favicon.ico")
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusNotFound)
return
}
w.WriteHeader(http.StatusOK)
w.Write([]byte(favicon))
}

// StaticRoute - css and js
func StaticRoute(w http.ResponseWriter, r *http.Request) {
path := r.URL.RequestURI()
// if strings.HasPrefix(path, "/t/") {
// path = path[2:]
// }
if strings.HasPrefix(path, "/static/css") {
w.Header().Set("content-type", "text/css")
}
if strings.HasPrefix(path, "/static/js") {
w.Header().Set("content-type", "application/javascript")
}
if strings.HasSuffix(path, ".svg") {
w.Header().Set("content-type", "image/svg+xml")
}
file, err := appBox.Find(path)
if err != nil {
w.WriteHeader(http.StatusNotFound)
return
}
w.WriteHeader(http.StatusOK)
w.Write([]byte(file))
}
27 changes: 27 additions & 0 deletions frontend/app/ jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
// The root of your source code, typically /src
// `<rootDir>` is a token Jest substitutes
roots: ["<rootDir>/src"],

// Jest transformations -- this adds support for TypeScript
// using ts-jest
transform: {
"^.+\\.tsx?$": "ts-jest"
},

// Runs special logic, such as cleaning up components
// when using React Testing Library and adds special
// extended assertions to Jest
setupFilesAfterEnv: [
"@testing-library/react/cleanup-after-each",
"@testing-library/jest-dom/extend-expect"
],

// Test spec file resolution pattern
// Matches parent folder `__tests__` and filename
// should contain `test` or `spec`.
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",

// Module file extensions for importing
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
};
11 changes: 11 additions & 0 deletions frontend/app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[{src,scripts}/**.{ts,json,js}]

root = true

end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
single_qoute = true
30 changes: 30 additions & 0 deletions frontend/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

yarn.lock
package-lock.json

# config in frontend
./src/config/host.ts
./src/config/ModeDispatcher.tsx
4 changes: 4 additions & 0 deletions frontend/app/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

cd frontend/app && yarn run lint
7 changes: 7 additions & 0 deletions frontend/app/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none"
}
21 changes: 21 additions & 0 deletions frontend/app/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "npm start",
"name": "Run npm start",
"request": "launch",
"type": "node-terminal"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
6 changes: 6 additions & 0 deletions frontend/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
./frontend/app: **npm run build**

./frontend: **$HOME/go/bin/packr2**

.: **go build**

4 changes: 4 additions & 0 deletions frontend/app/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: ['@babel/preset-env'],
plugins: [['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }]]
};
9 changes: 9 additions & 0 deletions frontend/app/craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { whenTest } = require('@craco/craco')

module.exports = {
babel: {
plugins: [
...whenTest(() => [['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }]], [])
]
}
}
1 change: 1 addition & 0 deletions frontend/app/craco.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions frontend/app/docs/CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This guide is intended for anyone who is new to the project or is just looking for a refresher on how to contribute to the project or open a PR

There are a few things you might want to check before opening a PR as it may get your PR merged quicker

1). styling with colors.tsx, In this project's frontend we use a colors.tsx file to keep the colors consistent throughout the project and it takes effort to change styling throughout if there is a single source for colors. If you find yourself using colors in the css or tsx files themselves check to see if there is a corresponding color you can use from colors.tsx
15 changes: 15 additions & 0 deletions frontend/app/docs/developerSetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Signup flow: https://www.loom.com/share/29a63d78c063498690d03e82637086c6

Setting up sphinx-tribes frontend for your development env

*This will still require you to have a functional sphinx account and client*

you will need to modify two file
`./frontend/app/src/host.ts` to `return "people.sphinx.chat"`

also `./frontend/app/src/App.tsx` at the bottom you want to modify `localhost:3000` to map to community

then in `./frontend/app/` run
`npm install && npm run start`

and then you should have your development env setup
1 change: 1 addition & 0 deletions frontend/app/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = '';
Loading

0 comments on commit 56a42ee

Please sign in to comment.