Fakultas Ilmu Komputer UI

Commit 7ecdc3f4 authored by Jonathan Christopher Jakub's avatar Jonathan Christopher Jakub
Browse files

[GREEN] Fix None value on log.latest_version and remove logged_revision

parent cfd6fcf1
Pipeline #39017 passed with stages
......@@ -34,12 +34,6 @@ class Log(models.Model):
Model = apps.get_model(model_app, self.model_name)
return Model
@property
def logged_revision(self):
Model = self.get_model()
model_revision = Model.objects.filter(pk=self.revision_id).first()
return model_revision
@property
def latest_version(self):
Model = self.get_model()
......
......@@ -22,4 +22,5 @@ class LogSummarySerializer(serializers.ModelSerializer):
]
def get_latest_version(self, instance):
return str(instance.latest_version.pk)
if instance.latest_version:
return str(instance.latest_version.pk)
......@@ -88,10 +88,6 @@ class ActivityLogViewTest(APITestCase):
response_string = response.rendered_content.decode("utf-8")
self.assertIn('"detail":"Invalid page."', response_string)
def test_get_logged_revision_success(self):
logged_revision = self.log.logged_revision
self.assertEqual(logged_revision, self.case)
def test_get_latest_version_success(self):
latest_version = self.log.latest_version
latest_editable_version = self.case
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment