Skip to content

Commit

Permalink
commit includes:: The system must collect each answer on each quiz ta…
Browse files Browse the repository at this point in the history
…ken #549 (#652)

BUG: Update Titles on FASCSA and Drone #631
Update Treasury lesson links #647
Dependabot Alert: Regular Expression Denial of Service (ReDoS) in micromatch #628
  • Loading branch information
john-labbate authored Sep 20, 2024
1 parent 37afe3d commit de3c1ef
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 57 deletions.
32 changes: 32 additions & 0 deletions alembic/versions/12049328fd0a_add_results_to_quiz_completions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""add results to quiz completions
Revision ID: 12049328fd0a
Revises: 291331bea272
Create Date: 2024-09-11 10:23:37.753893
"""
from alembic import op
from sqlalchemy.dialects import postgresql
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '12049328fd0a'
down_revision = '291331bea272'
branch_labels = None
depends_on = None


def upgrade():
# Add the 'responses' column
op.add_column('quiz_completions', sa.Column(
'responses',
postgresql.JSONB(astext_type=sa.Text()),
nullable=False,
server_default=sa.text("'{}'::jsonb")
))


def downgrade():
# Remove the 'responses' column
op.drop_column('quiz_completions', 'responses')
107 changes: 60 additions & 47 deletions training-front-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ As part of the NDAA, Sections 1821 and 1826 contain prohibitions on using the GS
**Section 1826** - PROHIBITION ON USE OF GOVERNMENT-ISSUED PURCHASE CARDS TO PURCHASE COVERED UNMANNED AIRCRAFT SYSTEMS FROM COVERED FOREIGN ENTITIES
- Effective immediately, Government-issued Purchase Cards may not be used to procure any covered unmanned aircraft system from a covered foreign entity.

#### Cleared Drone Vendors
### Cleared Drone Vendors
- A cleared list of drone vendors is available from the Defense Innovation Unit.
- https://www.diu.mil/blue-uas-cleared-list
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Card/account holders can purchase any commercially available supply or service w
The GSA SmartPay Purchase card/account has a solid grounding in key statutes and regulations. Although many small-scale purchases are low in dollar amount, taken together, small-scale purchases account for billions of dollars in contracting and are a critical part of the government's acquisition process.

Here are some of the key statutes and regulations:
- [Treasury Financial Manual, Chapter 4500 Government Purchase Cards](https://tfm.fiscal.treasury.gov/v1/p4/c450.html) prescribes procedures that apply to all departments and agencies that use the GSA SmartPay Purchase card/account.
- [Treasury Financial Manual, Chapter 4500 Government Purchase Cards](https://tfx.treasury.gov/tfm/volume1/part4/chapter-4500-government-purchase-cards) prescribes procedures that apply to all departments and agencies that use the GSA SmartPay Purchase card/account.
- Purchases of supplies and services are covered by the [Federal Acquisition Regulation](https://www.acquisition.gov/) (FAR).
- Management of property is covered by the [Federal Management Regulations](http://www.gsa.gov/federalmanagementregulation) (FMR).
- [OMB Circular A-123, Appendix B [PDF, 71 pages]](https://www.whitehouse.gov/wp-content/uploads/2019/08/Issuance-of-Revised-Appendix-B-to-OMB-Circular-A-123.pdf) contains governmentwide guidelines on account management.
Expand Down
4 changes: 2 additions & 2 deletions training-front-end/src/content/training_purchase/lesson05.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ As part of the NDAA, Sections 1821 and 1826 contain prohibitions on using the GS
**Section 1826** - PROHIBITION ON USE OF GOVERNMENT-ISSUED PURCHASE CARDS TO PURCHASE COVERED UNMANNED AIRCRAFT SYSTEMS FROM COVERED FOREIGN ENTITIES
- Effective immediately, Government-issued Purchase Cards may not be used to procure any covered unmanned aircraft system from a covered foreign entity.

#### Cleared Drone Vendors
### Cleared Drone Vendors
- A cleared list of drone vendors is available from the Defense Innovation Unit.
- https://www.diu.mil/blue-uas-cleared-list

Expand Down Expand Up @@ -179,7 +179,7 @@ Effective October 1, 2022, the following apply:
- The maximum daily limit from a single payor is $24,999.99.
- Total monthly transactions, based on a 30 day rolling period, from a single payor can be no more than $100,000.00.

The government’s card acceptance policies can be found in [Treasury Financial Manual (TFM) Vol. I, Part 5, Chapter 7000](https://tfm.fiscal.treasury.gov/v1/p5/c700). It also addresses limitations on credit card transactions. Additionally, consider the following:
The government’s card acceptance policies can be found in [Treasury Financial Manual (TFM) Vol. I, Part 5, Chapter 7000](https://tfx.treasury.gov/tfm/volume1/part5/chapter-7000-credit-and-debit-card-collection-transactions). It also addresses limitations on credit card transactions. Additionally, consider the following:

- Customers cannot divide transactions into smaller pieces to evade these limits.
- Treasury retains the option to change limits. One goal is to reduce the fees the government pays when it accepts the purchase card/account for large transactions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ As part of the NDAA, Sections 1821 and 1826 contain prohibitions on using the GS
**Section 1826** - PROHIBITION ON USE OF GOVERNMENT-ISSUED PURCHASE CARDS TO PURCHASE COVERED UNMANNED AIRCRAFT SYSTEMS FROM COVERED FOREIGN ENTITIES
- Effective immediately, Government-issued Purchase Cards may not be used to procure any covered unmanned aircraft system from a covered foreign entity.

#### Cleared Drone Vendors
### Cleared Drone Vendors
- A cleared list of drone vendors is available from the Defense Innovation Unit.
- https://www.diu.mil/blue-uas-cleared-list

Expand Down Expand Up @@ -171,7 +171,7 @@ Effective October 1, 2022, the following apply:
- The maximum daily limit from a single payor is $24,999.99.
- Total monthly transactions, based on a 30 day rolling period, from a single payor can be no more than $100,000.00.

The government’s card acceptance policies can be found in [Treasury Financial Manual (TFM) Vol. I, Part 5, Chapter 7000](https://tfm.fiscal.treasury.gov/v1/p5/c700). It also addresses limitations on credit card transactions. Additionally, consider the following:
The government’s card acceptance policies can be found in [Treasury Financial Manual (TFM) Vol. I, Part 5, Chapter 7000](https://tfx.treasury.gov/tfm/volume1/part5/chapter-7000-credit-and-debit-card-collection-transactions). It also addresses limitations on credit card transactions. Additionally, consider the following:

- Customers cannot divide transactions into smaller pieces to evade these limits.
- Treasury retains the option to change limits. One goal is to reduce the fees the government pays when it accepts the purchase card/account for large transactions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ As part of the NDAA, Sections 1821 and 1826 contain prohibitions on using the GS
**Section 1826** - PROHIBITION ON USE OF GOVERNMENT-ISSUED PURCHASE CARDS TO PURCHASE COVERED UNMANNED AIRCRAFT SYSTEMS FROM COVERED FOREIGN ENTITIES
- Effective immediately, Government-issued Purchase Cards may not be used to procure any covered unmanned aircraft system from a covered foreign entity.

#### Cleared Drone Vendors
### Cleared Drone Vendors
- A cleared list of drone vendors is available from the Defense Innovation Unit.
- https://www.diu.mil/blue-uas-cleared-list
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ As part of the NDAA, Sections 1821 and 1826 contain prohibitions on using the GS
**Section 1826** - PROHIBITION ON USE OF GOVERNMENT-ISSUED PURCHASE CARDS TO PURCHASE COVERED UNMANNED AIRCRAFT SYSTEMS FROM COVERED FOREIGN ENTITIES
- Effective immediately, Government-issued Purchase Cards may not be used to procure any covered unmanned aircraft system from a covered foreign entity.

#### Cleared Drone Vendors
### Cleared Drone Vendors
- A cleared list of drone vendors is available from the Defense Innovation Unit.
- https://www.diu.mil/blue-uas-cleared-list
2 changes: 2 additions & 0 deletions training/models/quiz_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from training.models import Base
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import ForeignKey, func
from typing import Any


class QuizCompletion(Base):
Expand All @@ -12,3 +13,4 @@ class QuizCompletion(Base):
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
passed: Mapped[bool] = mapped_column()
submit_ts: Mapped[datetime] = mapped_column(server_default=func.now())
responses: Mapped[dict[str, Any]] = mapped_column()
3 changes: 2 additions & 1 deletion training/repositories/quiz_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ def create(self, quiz_completion: schemas.QuizCompletionCreate) -> models.QuizCo
return self.save(models.QuizCompletion(
quiz_id=quiz_completion.quiz_id,
user_id=quiz_completion.user_id,
passed=quiz_completion.passed
passed=quiz_completion.passed,
responses=quiz_completion.responses
))
2 changes: 2 additions & 0 deletions training/schemas/quiz_completion.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from datetime import datetime
from pydantic import ConfigDict, BaseModel
from typing import Any


class QuizCompletionBase(BaseModel):
quiz_id: int
user_id: int
passed: bool
responses: dict[str, Any]


class QuizCompletionCreate(QuizCompletionBase):
Expand Down
3 changes: 3 additions & 0 deletions training/services/quiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ def grade(self, quiz_id: int, user_id: int, submission: QuizSubmission) -> QuizG
quiz_completion_id=None
)

responses_dict = submission.model_dump()

result = self.quiz_completion_repo.create(QuizCompletionCreate(
quiz_id=quiz_id,
user_id=user_id,
passed=grade.passed,
responses=responses_dict
))

grade.quiz_completion_id = result.id
Expand Down
3 changes: 2 additions & 1 deletion training/tests/test_quiz_completion_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def valid_quiz_completion_create(
return schemas.QuizCompletionCreate(
quiz_id=valid_quiz_ids[-1],
user_id=valid_user_ids[-1],
passed=True
passed=True,
responses=dict([{'question_id': 0, 'response_ids': [1]}, {'question_id': 1, 'response_ids': [1]}, {'question_id': 2, 'response_ids': [2]}])
)


Expand Down

0 comments on commit de3c1ef

Please sign in to comment.