Merge pull request #9 from teste-de-progresso/update-new-assessement-page
add assessement endpoint
This commit is contained in:
@@ -7,12 +7,14 @@ import { AssessmentRoutePaths, DashboardRoutePaths, QuestionRoutePaths } from ".
|
||||
import { RootState } from "../../services/store";
|
||||
import { turnOff } from "../../services/store/unsavedChanges";
|
||||
import { Dialog } from '../Dialog';
|
||||
import { useCurrentUser } from "../../contexts";
|
||||
|
||||
export const AppbarTabs = () => {
|
||||
const unsavedChanges = useSelector((state: RootState) => state.unsavedChanges)
|
||||
const dispatch = useDispatch()
|
||||
const location = useLocation()
|
||||
const history = useHistory()
|
||||
const { isOnlyTeacher } = useCurrentUser()
|
||||
|
||||
const [newPath, setNewPath] = useState<string>()
|
||||
|
||||
@@ -45,14 +47,16 @@ export const AppbarTabs = () => {
|
||||
tabel: 'Questões',
|
||||
pathname: QuestionRoutePaths.index,
|
||||
isCurrent: location.pathname.includes('question'),
|
||||
},
|
||||
{
|
||||
icon: <DocumentIcon className="w-6" />,
|
||||
tabel: 'Avaliações',
|
||||
pathname: AssessmentRoutePaths.index,
|
||||
isCurrent: false,
|
||||
}]
|
||||
|
||||
if (!isOnlyTeacher) {
|
||||
links.push({
|
||||
icon: <DocumentIcon className="w-6" />,
|
||||
tabel: 'Avaliações',
|
||||
pathname: AssessmentRoutePaths.index,
|
||||
isCurrent: false,
|
||||
})
|
||||
}
|
||||
]
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
23
app/models/assessment.rb
Normal file
23
app/models/assessment.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: assessments
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# observations :text
|
||||
# params :jsonb
|
||||
# title :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# user_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_assessments_on_user_id (user_id)
|
||||
#
|
||||
# Foreign Keys
|
||||
#
|
||||
# fk_rails_... (user_id => users.id)
|
||||
#
|
||||
class Assessment < ApplicationRecord
|
||||
belongs_to :user
|
||||
end
|
||||
13
app/policies/assessment_policy.rb
Normal file
13
app/policies/assessment_policy.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class AssessmentPolicy < ApplicationPolicy
|
||||
class Scope < Scope
|
||||
def resolve
|
||||
scope.all
|
||||
end
|
||||
|
||||
def index?
|
||||
@roles.find do |role|
|
||||
admin nde coordinator center_director pro_rector teacher
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user