Skip to content

Commit

Permalink
Remove CREATE verb on Daily report controller
Browse files Browse the repository at this point in the history
Fixed a bug on the daily report related to item

Add @commit to GET and LIST daily-report verbs

Enhance test list of daily reports

Updated some of labels of daily report model

Modified the routing to the phase controller

Added the method list to the phase controller

v0.43.0a7

Add daily report migration

v0.43.1a7

 Revise time card to daily report (#811)

* Revise time card to daily report, closes #805 closes #806 closes #807 closes #808 closes #809

* Remove CREATE verb on Daily report controller

* Fixed a bug on the daily report related to item

* Add @commit to GET and LIST daily-report verbs

* Enhance test list of daily reports

Implemented the list method on the phase controller (#814)

* Implemented the list method on the phase controller

* The coding style is modified

 Created custom exception classes (#778)

* Renamed custom exception errors

Created custom exception classes

Created custom exception classes

Created custom exception classes

Fixed coding style

Created custom exception classes

* Enhance imports

* Typo

* Renamed none to null

Implement filtering Item by different zones, closes #764

Add issue dict to item to_dict method return value

Implement verb ESTIMATE on Item, closes #812

Add test cases

Enhance coding style

Added the issue metadata into item model, closes #819

Increase the coverage (#810)

* Check some test for increase coverage

* Check some test for increase coverage

* Some not found field check.

* Add test for tokens

* Remove redundant functions

* Added new test case for increase coverage

* Revise code

* Add Not found in draftissue

* Add Not found in draftissue

* Add check project id

* chat room exception replace

* Added test case related to the audit log

* Resolved the conflict

* Some revise

* Resolved the conflict

* Added new test case related to the auditlog

Add issue dict to item to_dict method return value (#816)

Add project instance to issue response to_dict and issue to item response

Enhance item model to_dict
  • Loading branch information
shayan committed May 19, 2019
1 parent f80141e commit ef57b30
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 151 deletions.
2 changes: 1 addition & 1 deletion dolphin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .controllers.root import Root


__version__ = '0.42.1a7'
__version__ = '0.43.1a7'


class Dolphin(Application):
Expand Down
3 changes: 2 additions & 1 deletion dolphin/controllers/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,6 @@ def update(self, id):
@commit
def list(self):
self._create_dailyreport_if_needed()
return DBSession.query(Dailyreport)
return DBSession.query(Dailyreport) \
.filter(Dailyreport.item_id == self.item.id)

80 changes: 80 additions & 0 deletions dolphin/migration/versions/84d5fef5976a_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
"""empty message
Revision ID: 84d5fef5976a
Revises: a2410e75c467
Create Date: 2019-05-13 14:33:29.207279
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '84d5fef5976a'
down_revision = 'a2410e75c467'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
'dailyreport',
sa.Column('item_id', sa.Integer(), nullable=False),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('date', sa.Date(), nullable=False),
sa.Column('hours', sa.Integer(), nullable=True),
sa.Column('note', sa.Unicode(), nullable=True),
sa.ForeignKeyConstraint(['item_id'], ['item.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.drop_table('timecard')
op.add_column(
'item',
sa.Column('estimated_hours', sa.Integer(), nullable=True)
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('item', 'estimated_hours')
op.create_table(
'timecard',
sa.Column(
'id',
sa.INTEGER(),
autoincrement=True,
nullable=False
),
sa.Column(
'start_date',
postgresql.TIMESTAMP(),
autoincrement=False,
nullable=False
),
sa.Column(
'end_date',
postgresql.TIMESTAMP(),
autoincrement=False,
nullable=False
),
sa.Column(
'estimated_time',
sa.INTEGER(),
autoincrement=False,
nullable=False
),
sa.Column(
'summary',
sa.VARCHAR(),
autoincrement=False,
nullable=False
),
sa.PrimaryKeyConstraint(
'id',
name='timecard_pkey'
)
)
op.drop_table('dailyreport')
# ### end Alembic commands ###
2 changes: 1 addition & 1 deletion dolphin/models/dailyreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Dailyreport(OrderingMixin, FilteringMixin, PaginationMixin, \
Unicode,
min_length=1,
max_length=1024,
label='Lorem Isum',
label='Notes',
watermark='Lorem Ipsum',
not_none=False,
nullable=True,
Expand Down
15 changes: 15 additions & 0 deletions dolphin/models/item.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime

from restfulpy.orm import Field, DeclarativeBase, relationship
from restfulpy.orm.metadata import MetadataField
from restfulpy.orm.mixins import TimestampMixin, OrderingMixin, \
FilteringMixin, PaginationMixin
from sqlalchemy import Integer, ForeignKey, UniqueConstraint, DateTime, Enum, \
Expand Down Expand Up @@ -151,3 +152,17 @@ def to_dict(self):
item_dict['hoursWorked'] = self.hours_worked
return item_dict

@classmethod
def iter_metadata_fields(cls):
yield from super().iter_metadata_fields()
yield MetadataField(
name='issue',
key='issue',
label='Lorem Ipsun',
required=False,
readonly=True,
watermark='Lorem Ipsum',
example='Lorem Ipsum',
message='Lorem Ipsun',
)

148 changes: 0 additions & 148 deletions dolphin/tests/test_dailyreport_create.py

This file was deleted.

6 changes: 6 additions & 0 deletions dolphin/tests/test_item_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,15 @@ def test_estimate(self):
assert status == '905 Start Date Is Null'

when(
<<<<<<< HEAD
'Start date pattern is wrong',
json=given | dict(startDate='invalid pattern')
)
assert status == '791 Invalid Start Date Format'

when(
=======
>>>>>>> Remove CREATE verb on Daily report controller
'End date is not in form',
json=given - 'endDate'
)
Expand All @@ -181,12 +184,15 @@ def test_estimate(self):
assert status == '906 End Date Is Null'

when(
<<<<<<< HEAD
'End date pattern is wrong',
json=given | dict(endDate='invalid pattern')
)
assert status == '790 Invalid End Date Format'

when(
=======
>>>>>>> Remove CREATE verb on Daily report controller
'Estimated hours field is not in form',
json=given - 'estimatedHours'
)
Expand Down

0 comments on commit ef57b30

Please sign in to comment.